File tree 2 files changed +6
-3
lines changed
compiler/rustc_expand/src/mbe
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,11 @@ pub(super) fn failed_to_match_macro<'cx>(
67
67
|| matches ! ( token. kind, TokenKind :: Interpolated ( _) ) )
68
68
{
69
69
err. note ( "captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens" ) ;
70
- err. note ( "see https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment for more information" ) ;
71
- err. help ( "try using `:tt` instead in the macro definition" ) ;
70
+ err. note ( "see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information" ) ;
71
+
72
+ if !def_span. is_dummy ( ) && !cx. source_map ( ) . is_imported ( def_span) {
73
+ err. help ( "try using `:tt` instead in the macro definition" ) ;
74
+ }
72
75
}
73
76
74
77
// Check whether there's a missing comma in this macro call, like `println!("{}" a);`
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ LL | macro n(a $nt_item b) {
19
19
LL | complex_nonterminal!(enum E {});
20
20
| ------------------------------- in this macro invocation
21
21
= note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
22
- = note: see https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment for more information
22
+ = note: see < https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
23
23
= help: try using `:tt` instead in the macro definition
24
24
= note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
25
25
You can’t perform that action at this time.
0 commit comments