Skip to content

Commit 7dc7219

Browse files
committed
Add failing regression test for issue 86
error[E0425]: cannot find value `_0` in this scope --> tests/test_display.rs:208:29 | 208 | #[derive(Debug, Error)] | ^^^^^ not found in this scope
1 parent f79a85f commit 7dc7219

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_display.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,22 @@ fn test_field() {
198198

199199
assert("0", Error(Inner { data: 0 }));
200200
}
201+
202+
#[test]
203+
fn test_macro_rules() {
204+
// Regression test for https://github.com/dtolnay/thiserror/issues/86
205+
206+
macro_rules! decl_error {
207+
($variant:ident($value:ident)) => {
208+
#[derive(Debug, Error)]
209+
pub enum Error {
210+
#[error("{0:?}")]
211+
$variant($value),
212+
}
213+
};
214+
}
215+
216+
decl_error!(Repro(u8));
217+
218+
assert("0", Error::Repro(0));
219+
}

0 commit comments

Comments
 (0)