diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index 4638ab62379e6..bfe0d54e64521 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -484,7 +484,7 @@ passes_naked_functions_asm_options = passes_naked_functions_incompatible_attribute = attribute incompatible with `#[naked]` - .label = this attribute is incompatible with `#[naked]` + .label = the `{$attr}` attribute is incompatible with `#[naked]` .naked_attribute = function marked with `#[naked]` here passes_naked_functions_must_use_noreturn = diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index f5cb674646684..0ac74e07b7b1d 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -461,6 +461,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { self.dcx().emit_err(errors::NakedFunctionIncompatibleAttribute { span: other_attr.span, naked_span: attr.span, + attr: other_attr.name_or_empty(), }); return false; diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index 7b41ad3eb37e5..b195ba973ce29 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -1190,6 +1190,7 @@ pub struct NakedFunctionIncompatibleAttribute { pub span: Span, #[label(passes_naked_attribute)] pub naked_span: Span, + pub attr: Symbol, } #[derive(Diagnostic)] diff --git a/tests/ui/asm/naked-functions-inline.stderr b/tests/ui/asm/naked-functions-inline.stderr index 9754551b90a88..f6eb31468ac37 100644 --- a/tests/ui/asm/naked-functions-inline.stderr +++ b/tests/ui/asm/naked-functions-inline.stderr @@ -4,7 +4,7 @@ error[E0736]: attribute incompatible with `#[naked]` LL | #[naked] | -------- function marked with `#[naked]` here LL | #[inline] - | ^^^^^^^^^ this attribute is incompatible with `#[naked]` + | ^^^^^^^^^ the `inline` attribute is incompatible with `#[naked]` error[E0736]: attribute incompatible with `#[naked]` --> $DIR/naked-functions-inline.rs:20:1 @@ -12,7 +12,7 @@ error[E0736]: attribute incompatible with `#[naked]` LL | #[naked] | -------- function marked with `#[naked]` here LL | #[inline(always)] - | ^^^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]` + | ^^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[naked]` error[E0736]: attribute incompatible with `#[naked]` --> $DIR/naked-functions-inline.rs:27:1 @@ -20,7 +20,7 @@ error[E0736]: attribute incompatible with `#[naked]` LL | #[naked] | -------- function marked with `#[naked]` here LL | #[inline(never)] - | ^^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]` + | ^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[naked]` error: aborting due to 3 previous errors diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr index 1f2eb06aa577d..0625ed1183ba5 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr @@ -2,7 +2,7 @@ error[E0736]: attribute incompatible with `#[naked]` --> $DIR/error-with-naked.rs:6:1 | LL | #[track_caller] - | ^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]` + | ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[naked]` LL | LL | #[naked] | -------- function marked with `#[naked]` here @@ -11,7 +11,7 @@ error[E0736]: attribute incompatible with `#[naked]` --> $DIR/error-with-naked.rs:18:5 | LL | #[track_caller] - | ^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]` + | ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[naked]` LL | LL | #[naked] | -------- function marked with `#[naked]` here