Skip to content

Commit

Permalink
Add failing regression test for issue 86
Browse files Browse the repository at this point in the history
    error[E0425]: cannot find value `_0` in this scope
       --> tests/test_display.rs:208:29
        |
    208 |             #[derive(Debug, Error)]
        |                             ^^^^^ not found in this scope
  • Loading branch information
dtolnay committed May 15, 2020
1 parent f79a85f commit 7dc7219
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,22 @@ fn test_field() {

assert("0", Error(Inner { data: 0 }));
}

#[test]
fn test_macro_rules() {
// Regression test for https://github.com/dtolnay/thiserror/issues/86

macro_rules! decl_error {
($variant:ident($value:ident)) => {
#[derive(Debug, Error)]
pub enum Error {
#[error("{0:?}")]
$variant($value),
}
};
}

decl_error!(Repro(u8));

assert("0", Error::Repro(0));
}

0 comments on commit 7dc7219

Please sign in to comment.