File tree Expand file tree Collapse file tree 4 files changed +40
-1
lines changed
rustc_error_codes/src/error_codes Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ The following code generation attributes are incompatible with `#[naked]`:
55
66 * ` #[inline] `
77 * ` #[track_caller] `
8+ * ` #[target_feature] `
89
910Erroneous code example:
1011
Original file line number Diff line number Diff line change @@ -345,7 +345,10 @@ impl CheckAttrVisitor<'_> {
345345 attrs : & [ Attribute ] ,
346346 ) -> bool {
347347 for any_attr in attrs {
348- if any_attr. has_name ( sym:: track_caller) || any_attr. has_name ( sym:: inline) {
348+ if any_attr. has_name ( sym:: track_caller)
349+ || any_attr. has_name ( sym:: inline)
350+ || any_attr. has_name ( sym:: target_feature)
351+ {
349352 struct_span_err ! (
350353 self . tcx. sess,
351354 any_attr. span,
Original file line number Diff line number Diff line change 1+ // ignore-arm
2+ // ignore-aarch64
3+ // ignore-wasm
4+ // ignore-emscripten
5+ // ignore-mips
6+ // ignore-mips64
7+ // ignore-powerpc
8+ // ignore-powerpc64
9+ // ignore-powerpc64le
10+ // ignore-riscv64
11+ // ignore-s390x
12+ // ignore-sparc
13+ // ignore-sparc64
14+ // needs-asm-support
15+
16+ #![ feature( naked_functions) ]
17+ #![ crate_type = "lib" ]
18+
19+ use std:: arch:: asm;
20+
21+ #[ target_feature( enable = "sse2" ) ]
22+ //~^ ERROR cannot use additional code generation attributes with `#[naked]`
23+ #[ naked]
24+ pub unsafe extern "C" fn naked_target_feature ( ) {
25+ asm ! ( "" , options( noreturn) ) ;
26+ }
Original file line number Diff line number Diff line change 1+ error[E0736]: cannot use additional code generation attributes with `#[naked]`
2+ --> $DIR/naked-functions-target-feature.rs:21:1
3+ |
4+ LL | #[target_feature(enable = "sse2")]
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+ error: aborting due to previous error
8+
9+ For more information about this error, try `rustc --explain E0736`.
You can’t perform that action at this time.
0 commit comments