From 9918693037dce8aa4bb6f08741b6812923486c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 19 Jun 2024 11:26:03 +0200 Subject: Merging upstream version 1.76.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/macros/trace_faulty_macros.stderr | 49 +++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'tests/ui/macros/trace_faulty_macros.stderr') diff --git a/tests/ui/macros/trace_faulty_macros.stderr b/tests/ui/macros/trace_faulty_macros.stderr index 21e47da07..81047c7a2 100644 --- a/tests/ui/macros/trace_faulty_macros.stderr +++ b/tests/ui/macros/trace_faulty_macros.stderr @@ -20,7 +20,7 @@ LL | my_faulty_macro!(); | ^^^^^^^^^^^^^^^^^^ | = note: expanding `my_faulty_macro! { }` - = note: to `my_faulty_macro! (bcd) ;` + = note: to `my_faulty_macro! (bcd);` = note: expanding `my_faulty_macro! { bcd }` error: recursion limit reached while expanding `my_recursive_macro!` @@ -42,15 +42,15 @@ LL | my_recursive_macro!(); | ^^^^^^^^^^^^^^^^^^^^^ | = note: expanding `my_recursive_macro! { }` - = note: to `my_recursive_macro! () ;` + = note: to `my_recursive_macro! ();` = note: expanding `my_recursive_macro! { }` - = note: to `my_recursive_macro! () ;` + = note: to `my_recursive_macro! ();` = note: expanding `my_recursive_macro! { }` - = note: to `my_recursive_macro! () ;` + = note: to `my_recursive_macro! ();` = note: expanding `my_recursive_macro! { }` - = note: to `my_recursive_macro! () ;` + = note: to `my_recursive_macro! ();` -error: expected expression, found `A { a: a, b: 0, c: _, .. }` +error: expected expression, found pattern `A { a: a, b: 0, c: _, .. }` --> $DIR/trace_faulty_macros.rs:16:9 | LL | $a @@ -69,6 +69,28 @@ LL | #[derive(Debug)] LL | fn use_derive_macro_as_attr() {} | -------------------------------- not a `struct`, `enum` or `union` +error: expected expression, found pattern `1 + 1` + --> $DIR/trace_faulty_macros.rs:49:37 + | +LL | (let $p:pat = $e:expr) => {test!(($p,$e))}; + | ------- -- this is interpreted as expression, but it is expected to be pattern + | | + | this macro fragment matcher is expression +... +LL | (($p:pat, $e:pat)) => {let $p = $e;}; + | ------ ^^ expected expression + | | + | this macro fragment matcher is pattern +... +LL | test!(let x = 1+1); + | ------------------ + | | | + | | this is expected to be expression + | in this macro invocation + | + = note: when forwarding a matched fragment to another macro-by-example, matchers in the second macro will see an opaque AST of the fragment type, not the underlying tokens + = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) + note: trace_macro --> $DIR/trace_faulty_macros.rs:36:13 | @@ -76,10 +98,21 @@ LL | let a = pat_macro!(); | ^^^^^^^^^^^^ | = note: expanding `pat_macro! { }` - = note: to `pat_macro! (A { a : a, b : 0, c : _, .. }) ;` + = note: to `pat_macro! (A { a : a, b : 0, c : _, .. });` = note: expanding `pat_macro! { A { a : a, b : 0, c : _, .. } }` = note: to `A { a: a, b: 0, c: _, .. }` -error: aborting due to 4 previous errors +note: trace_macro + --> $DIR/trace_faulty_macros.rs:53:5 + | +LL | test!(let x = 1+1); + | ^^^^^^^^^^^^^^^^^^ + | + = note: expanding `test! { let x = 1+1 }` + = note: to `test! ((x, 1 + 1))` + = note: expanding `test! { (x, 1 + 1) }` + = note: to `let x = 1 + 1 ;` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0774`. -- cgit v1.2.3