Skip to content

Commit a3bb010

Browse files
committed
allow #[target_feature] on #[naked] functions
1 parent c6a166b commit a3bb010

File tree

5 files changed

+7
-27
lines changed

5 files changed

+7
-27
lines changed

compiler/rustc_error_codes/src/error_codes/E0736.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Notable attributes that are incompatible with `#[naked]` are:
55

66
* `#[inline]`
77
* `#[track_caller]`
8-
* `#[target_feature]`
98
* `#[test]`, `#[ignore]`, `#[should_panic]`
109

1110
Erroneous code example:

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
423423
//
424424
// * `#[inline]`
425425
// * `#[track_caller]`
426-
// * `#[target_feature]`
427426
// * `#[test]`, `#[ignore]`, `#[should_panic]`
428427
//
429428
// NOTE: when making changes to this list, check that `error_codes/E0736.md` remains accurate
@@ -452,6 +451,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
452451
sym::instruction_set,
453452
// code generation
454453
sym::cold,
454+
sym::target_feature,
455455
// documentation
456456
sym::doc,
457457
];

tests/ui/asm/naked-functions-target-feature.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/ui/asm/naked-functions-target-feature.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/ui/asm/naked-functions.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ pub unsafe extern "C" fn compatible_codegen_attributes() {
231231
asm!("", options(noreturn, att_syntax));
232232
}
233233

234+
#[target_feature(enable = "sse2")]
235+
#[naked]
236+
pub unsafe extern "C" fn compatible_target_feature() {
237+
asm!("", options(noreturn));
238+
}
239+
234240
#[doc = "foo bar baz"]
235241
#[naked]
236242
pub unsafe extern "C" fn compatible_doc_attributes() {

0 commit comments

Comments
 (0)