diff --git a/src/test/ui/typeck/issue-81943.rs b/src/test/ui/typeck/issue-81943.rs index bb7adb4d4c027..790b7716c618f 100644 --- a/src/test/ui/typeck/issue-81943.rs +++ b/src/test/ui/typeck/issue-81943.rs @@ -2,4 +2,8 @@ fn f(f: F) { f(0); } fn main() { f(|x| dbg!(x)); //~ERROR f(|x| match x { tmp => { tmp } }); //~ERROR + macro_rules! d { + ($e:expr) => { match $e { x => { x } } } + } + f(|x| d!(x)); //~ERROR } diff --git a/src/test/ui/typeck/issue-81943.stderr b/src/test/ui/typeck/issue-81943.stderr index b14ad614aca34..ab2f4da4ec8eb 100644 --- a/src/test/ui/typeck/issue-81943.stderr +++ b/src/test/ui/typeck/issue-81943.stderr @@ -15,6 +15,20 @@ LL | f(|x| match x { tmp => { tmp } }); | | expected `()`, found `i32` | expected this to be `()` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/issue-81943.rs:6:38 + | +LL | ($e:expr) => { match $e { x => { x } } } + | ------------------^----- help: consider using a semicolon here + | | | + | | expected `()`, found `i32` + | expected this to be `()` +LL | } +LL | f(|x| d!(x)); + | ----- in this macro invocation + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`.