File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
compiler/rustc_expand/src/mbe Expand file tree Collapse file tree 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>(
6767 || matches ! ( token. kind, TokenKind :: Interpolated ( _) ) )
6868 {
6969 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+ }
7275 }
7376
7477 // 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) {
1919LL | complex_nonterminal!(enum E {});
2020 | ------------------------------- in this macro invocation
2121 = 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
2323 = help: try using `:tt` instead in the macro definition
2424 = note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
2525
You can’t perform that action at this time.
0 commit comments