1
Fork 0

Add a label to point to the lacking macro name definition

This commit is contained in:
Lin Yihai 2024-07-10 10:59:33 +08:00
parent 5be2ec7245
commit 2fca4ea317
6 changed files with 30 additions and 8 deletions

View file

@ -1439,7 +1439,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
);
if macro_kind == MacroKind::Bang && ident.name == sym::macro_rules {
err.subdiagnostic(MaybeMissingMacroRulesName { span: ident.span });
let label_span = ident.span.shrink_to_hi();
let mut spans = MultiSpan::from_span(label_span);
spans.push_span_label(label_span, "put a macro name here");
err.subdiagnostic(MaybeMissingMacroRulesName { spans: spans });
return;
}