Skip to content

Commit

Permalink
use attribute name that is incompatible in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Jul 26, 2024
1 parent 6f2318c commit 45e943f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@ pub struct NakedFunctionIncompatibleAttribute {
pub span: Span,
#[label(passes_naked_attribute)]
pub naked_span: Span,
pub attr: Symbol,
}

#[derive(Diagnostic)]
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/asm/naked-functions-inline.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ 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
|
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
|
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

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 45e943f

Please sign in to comment.