Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 56207b8

Browse files
committed
Skip help messages if macro span is from macro
1 parent 86230dc commit 56207b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_resolve/src/macros.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
548548

549549
err.span_label(path.span, format!("not {} {}", article, expected));
550550

551-
if kind == MacroKind::Derive && ext.macro_kind() != MacroKind::Derive {
551+
if !path.span.from_expansion() {
552552
// Suggest moving the macro out of the derive() as the macro isn't Derive
553-
err.span_help(path.span, "Remove from the surrounding `derive()`");
554-
err.help(format!("Add as non-Derive macro\n`#[{}]`", path_str));
553+
if kind == MacroKind::Derive && ext.macro_kind() != MacroKind::Derive {
554+
err.span_help(path.span, "Remove from the surrounding `derive()`");
555+
err.help(format!("Add as non-Derive macro\n`#[{}]`", path_str));
556+
}
555557
}
556558

557559
err.emit();

0 commit comments

Comments
 (0)