compiler: print the suggestion only for local macros
And wrap the link in the diagnostic in angle brackets. Signed-off-by: Lena Milizé <me@lvmn.org>
This commit is contained in:
parent
4b456cb683
commit
04f20d4ac8
2 changed files with 6 additions and 3 deletions
|
@ -67,8 +67,11 @@ pub(super) fn failed_to_match_macro<'cx>(
|
|||
|| matches!(token.kind, TokenKind::Interpolated(_)))
|
||||
{
|
||||
err.note("captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens");
|
||||
err.note("see https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment for more information");
|
||||
err.help("try using `:tt` instead in the macro definition");
|
||||
err.note("see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information");
|
||||
|
||||
if !def_span.is_dummy() && !cx.source_map().is_imported(def_span) {
|
||||
err.help("try using `:tt` instead in the macro definition");
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether there's a missing comma in this macro call, like `println!("{}" a);`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue