You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By only accepting `NtExpr` if it's a literal (possibly with a unary
minus).
This means various error cases are caught during parsing, instead of
during HIR lowering, and the `ArbitraryExpressionInPattern` error is no
longer needed.
Copy file name to clipboardExpand all lines: tests/ui/macros/trace_faulty_macros.stderr
+5-10Lines changed: 5 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -69,22 +69,18 @@ LL | #[derive(Debug)]
69
69
LL | fn use_derive_macro_as_attr() {}
70
70
| -------------------------------- not a `struct`, `enum` or `union`
71
71
72
-
error: expected expression, found pattern `1+1`
73
-
--> $DIR/trace_faulty_macros.rs:49:37
72
+
error: expected pattern, found expression `1+1`
73
+
--> $DIR/trace_faulty_macros.rs:46:42
74
74
|
75
75
LL | (let $p:pat = $e:expr) => {test!(($p,$e))};
76
-
| -- this is interpreted as expression, but it is expected to be pattern
76
+
| ^^ expected pattern
77
77
...
78
78
LL | (($p:pat, $e:pat)) => {let $p = $e;};
79
-
| ^^ expected expression
79
+
| ------ while parsing argument for this `pat` macro fragment
80
80
...
81
81
LL | test!(let x = 1+1);
82
-
| ------------------
83
-
| | |
84
-
| | this is expected to be expression
85
-
| in this macro invocation
82
+
| ------------------ in this macro invocation
86
83
|
87
-
= 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
88
84
= note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
0 commit comments