Skip to content

Commit 45e943f

Browse files
committed
use attribute name that is incompatible in error message
1 parent 6f2318c commit 45e943f

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

compiler/rustc_passes/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ passes_naked_functions_asm_options =
484484
485485
passes_naked_functions_incompatible_attribute =
486486
attribute incompatible with `#[naked]`
487-
.label = this attribute is incompatible with `#[naked]`
487+
.label = the `{$attr}` attribute is incompatible with `#[naked]`
488488
.naked_attribute = function marked with `#[naked]` here
489489
490490
passes_naked_functions_must_use_noreturn =

compiler/rustc_passes/src/check_attr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
461461
self.dcx().emit_err(errors::NakedFunctionIncompatibleAttribute {
462462
span: other_attr.span,
463463
naked_span: attr.span,
464+
attr: other_attr.name_or_empty(),
464465
});
465466

466467
return false;

compiler/rustc_passes/src/errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ pub struct NakedFunctionIncompatibleAttribute {
11901190
pub span: Span,
11911191
#[label(passes_naked_attribute)]
11921192
pub naked_span: Span,
1193+
pub attr: Symbol,
11931194
}
11941195

11951196
#[derive(Diagnostic)]

tests/ui/asm/naked-functions-inline.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ error[E0736]: attribute incompatible with `#[naked]`
44
LL | #[naked]
55
| -------- function marked with `#[naked]` here
66
LL | #[inline]
7-
| ^^^^^^^^^ this attribute is incompatible with `#[naked]`
7+
| ^^^^^^^^^ the `inline` attribute is incompatible with `#[naked]`
88

99
error[E0736]: attribute incompatible with `#[naked]`
1010
--> $DIR/naked-functions-inline.rs:20:1
1111
|
1212
LL | #[naked]
1313
| -------- function marked with `#[naked]` here
1414
LL | #[inline(always)]
15-
| ^^^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]`
15+
| ^^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[naked]`
1616

1717
error[E0736]: attribute incompatible with `#[naked]`
1818
--> $DIR/naked-functions-inline.rs:27:1
1919
|
2020
LL | #[naked]
2121
| -------- function marked with `#[naked]` here
2222
LL | #[inline(never)]
23-
| ^^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]`
23+
| ^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[naked]`
2424

2525
error: aborting due to 3 previous errors
2626

tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0736]: attribute incompatible with `#[naked]`
22
--> $DIR/error-with-naked.rs:6:1
33
|
44
LL | #[track_caller]
5-
| ^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]`
5+
| ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[naked]`
66
LL |
77
LL | #[naked]
88
| -------- function marked with `#[naked]` here
@@ -11,7 +11,7 @@ error[E0736]: attribute incompatible with `#[naked]`
1111
--> $DIR/error-with-naked.rs:18:5
1212
|
1313
LL | #[track_caller]
14-
| ^^^^^^^^^^^^^^^ this attribute is incompatible with `#[naked]`
14+
| ^^^^^^^^^^^^^^^ the `track_caller` attribute is incompatible with `#[naked]`
1515
LL |
1616
LL | #[naked]
1717
| -------- function marked with `#[naked]` here

0 commit comments

Comments
 (0)