diff --git a/compiler/rustc_error_codes/src/error_codes/E0787.md b/compiler/rustc_error_codes/src/error_codes/E0787.md index cee5082927026..ddb365a20b21d 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0787.md +++ b/compiler/rustc_error_codes/src/error_codes/E0787.md @@ -3,8 +3,6 @@ An unsupported naked function definition. Erroneous code example: ```compile_fail,E0787 -#![feature(naked_functions)] - #[naked] pub extern "C" fn f() -> u32 { 42 diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 32a9d081ed8c5..2727bfac23dcd 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -203,6 +203,8 @@ declare_features! ( /// Allows patterns with concurrent by-move and by-ref bindings. /// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref. (accepted, move_ref_pattern, "1.49.0", Some(68354), None), + /// Allows using `#[naked]` on functions. + (accepted, naked_functions, "1.60.0", Some(90957), None), /// Allows using `#![no_std]`. (accepted, no_std, "1.6.0", None, None), /// Allows defining identifiers beyond ASCII. diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index bfe2459dc8dc1..eedf6536586af 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -435,8 +435,6 @@ declare_features! ( (active, more_qualified_paths, "1.54.0", Some(86935), None), /// Allows the `#[must_not_suspend]` attribute. (active, must_not_suspend, "1.57.0", Some(83310), None), - /// Allows using `#[naked]` on functions. - (active, naked_functions, "1.9.0", Some(32408), None), /// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]` (active, native_link_modifiers, "1.53.0", Some(81490), None), /// Allows specifying the as-needed link modifier diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 3933746c319ec..1e63fb4751f19 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -360,6 +360,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Code generation: ungated!(inline, Normal, template!(Word, List: "always|never"), FutureWarnFollowing), ungated!(cold, Normal, template!(Word), WarnFollowing), + ungated!(naked, Normal, template!(Word), WarnFollowing), ungated!(no_builtins, CrateLevel, template!(Word), WarnFollowing), ungated!(target_feature, Normal, template!(List: r#"enable = "name""#), DuplicatesOk), ungated!(track_caller, Normal, template!(Word), WarnFollowing), @@ -379,7 +380,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== // Linking: - gated!(naked, Normal, template!(Word), WarnFollowing, naked_functions, experimental!(naked)), gated!( link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, raw_dylib, experimental!(link_ordinal) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index f4eba25475eee..88756cee581c3 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -2745,8 +2745,6 @@ declare_lint! { /// ### Example /// /// ```rust - /// #![feature(naked_functions)] - /// /// use std::arch::asm; /// /// #[naked] diff --git a/src/doc/unstable-book/src/compiler-flags/sanitizer.md b/src/doc/unstable-book/src/compiler-flags/sanitizer.md index d630f4ecb7b22..00e749705b22e 100644 --- a/src/doc/unstable-book/src/compiler-flags/sanitizer.md +++ b/src/doc/unstable-book/src/compiler-flags/sanitizer.md @@ -199,8 +199,6 @@ LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). ## Example ```text -#![feature(naked_functions)] - use std::arch::asm; use std::mem; diff --git a/src/test/codegen/naked-functions.rs b/src/test/codegen/naked-functions.rs index 51c7a0c615d00..a1aad5899da8f 100644 --- a/src/test/codegen/naked-functions.rs +++ b/src/test/codegen/naked-functions.rs @@ -3,7 +3,7 @@ // only-x86_64 #![crate_type = "lib"] -#![feature(naked_functions)] + use std::arch::asm; // CHECK: Function Attrs: naked diff --git a/src/test/codegen/naked-noinline.rs b/src/test/codegen/naked-noinline.rs index 13bc139ecd05a..8a12ff45523b2 100644 --- a/src/test/codegen/naked-noinline.rs +++ b/src/test/codegen/naked-noinline.rs @@ -2,8 +2,8 @@ // compile-flags: -O -Zmir-opt-level=3 // needs-asm-support // ignore-wasm32 + #![crate_type = "lib"] -#![feature(naked_functions)] use std::arch::asm; diff --git a/src/test/ui/asm/naked-functions-ffi.rs b/src/test/ui/asm/naked-functions-ffi.rs index c8bee504d02bb..cf513acf645f4 100644 --- a/src/test/ui/asm/naked-functions-ffi.rs +++ b/src/test/ui/asm/naked-functions-ffi.rs @@ -1,6 +1,6 @@ // check-pass // needs-asm-support -#![feature(naked_functions)] + #![crate_type = "lib"] use std::arch::asm; diff --git a/src/test/ui/asm/naked-functions-unused.rs b/src/test/ui/asm/naked-functions-unused.rs index 4360d9addf000..634ed06690554 100644 --- a/src/test/ui/asm/naked-functions-unused.rs +++ b/src/test/ui/asm/naked-functions-unused.rs @@ -1,8 +1,8 @@ // revisions: x86_64 aarch64 //[x86_64] only-x86_64 //[aarch64] only-aarch64 + #![deny(unused)] -#![feature(naked_functions)] #![crate_type = "lib"] pub trait Trait { diff --git a/src/test/ui/asm/naked-functions-unused.x86_64.stderr b/src/test/ui/asm/naked-functions-unused.x86_64.stderr index cf4a1d9174e3d..bfeec6f4cd5ee 100644 --- a/src/test/ui/asm/naked-functions-unused.x86_64.stderr +++ b/src/test/ui/asm/naked-functions-unused.x86_64.stderr @@ -5,7 +5,7 @@ LL | pub extern "C" fn function(a: usize, b: usize) -> usize { | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: the lint level is defined here - --> $DIR/naked-functions-unused.rs:4:9 + --> $DIR/naked-functions-unused.rs:5:9 | LL | #![deny(unused)] | ^^^^^^ diff --git a/src/test/ui/asm/naked-functions.rs b/src/test/ui/asm/naked-functions.rs index 5b4293972ea21..547b03570a21d 100644 --- a/src/test/ui/asm/naked-functions.rs +++ b/src/test/ui/asm/naked-functions.rs @@ -3,7 +3,6 @@ // ignore-spirv // ignore-wasm32 -#![feature(naked_functions)] #![feature(or_patterns)] #![feature(asm_const, asm_sym, asm_unwind)] #![crate_type = "lib"] @@ -127,7 +126,7 @@ pub unsafe fn default_abi() { } #[naked] -pub unsafe fn rust_abi() { +pub unsafe extern "Rust" fn rust_abi() { //~^ WARN Rust ABI is unsupported in naked functions asm!("", options(noreturn)); } diff --git a/src/test/ui/asm/naked-functions.stderr b/src/test/ui/asm/naked-functions.stderr index c1dcc433db6c6..984421d7950cf 100644 --- a/src/test/ui/asm/naked-functions.stderr +++ b/src/test/ui/asm/naked-functions.stderr @@ -1,35 +1,35 @@ error: asm with the `pure` option must have at least one output - --> $DIR/naked-functions.rs:111:14 + --> $DIR/naked-functions.rs:110:14 | LL | asm!("", options(readonly, nostack), options(pure)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:21:5 + --> $DIR/naked-functions.rs:20:5 | LL | mut a: u32, | ^^^^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:23:5 + --> $DIR/naked-functions.rs:22:5 | LL | &b: &i32, | ^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:25:6 + --> $DIR/naked-functions.rs:24:6 | LL | (None | Some(_)): Option>, | ^^^^^^^^^^^^^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:27:5 + --> $DIR/naked-functions.rs:26:5 | LL | P { x, y }: P, | ^^^^^^^^^^ error: referencing function parameters is not allowed in naked functions - --> $DIR/naked-functions.rs:36:5 + --> $DIR/naked-functions.rs:35:5 | LL | a + 1 | ^ @@ -37,7 +37,7 @@ LL | a + 1 = help: follow the calling convention in asm block to use parameters error[E0787]: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:34:1 + --> $DIR/naked-functions.rs:33:1 | LL | / pub unsafe extern "C" fn inc(a: u32) -> u32 { LL | | @@ -48,7 +48,7 @@ LL | | } | |_^ error: referencing function parameters is not allowed in naked functions - --> $DIR/naked-functions.rs:42:31 + --> $DIR/naked-functions.rs:41:31 | LL | asm!("/* {0} */", in(reg) a, options(noreturn)); | ^ @@ -56,13 +56,13 @@ LL | asm!("/* {0} */", in(reg) a, options(noreturn)); = help: follow the calling convention in asm block to use parameters error[E0787]: only `const` and `sym` operands are supported in naked functions - --> $DIR/naked-functions.rs:42:23 + --> $DIR/naked-functions.rs:41:23 | LL | asm!("/* {0} */", in(reg) a, options(noreturn)); | ^^^^^^^^^ error[E0787]: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:48:1 + --> $DIR/naked-functions.rs:47:1 | LL | / pub unsafe extern "C" fn inc_closure(a: u32) -> u32 { LL | | @@ -72,7 +72,7 @@ LL | | } | |_^ error[E0787]: only `const` and `sym` operands are supported in naked functions - --> $DIR/naked-functions.rs:65:10 + --> $DIR/naked-functions.rs:64:10 | LL | in(reg) a, | ^^^^^^^^^ @@ -87,7 +87,7 @@ LL | out(reg) e, | ^^^^^^^^^^ error[E0787]: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:63:5 + --> $DIR/naked-functions.rs:62:5 | LL | / asm!("/* {0} {1} {2} {3} {4} {5} {6} */", LL | | @@ -99,7 +99,7 @@ LL | | ); | |_____^ error[E0787]: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:54:1 + --> $DIR/naked-functions.rs:53:1 | LL | / pub unsafe extern "C" fn unsupported_operands() { LL | | @@ -119,7 +119,7 @@ LL | | } | |_^ error[E0787]: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:77:1 + --> $DIR/naked-functions.rs:76:1 | LL | / pub extern "C" fn missing_assembly() { LL | | @@ -127,25 +127,25 @@ LL | | } | |_^ error[E0787]: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:84:5 + --> $DIR/naked-functions.rs:83:5 | LL | asm!(""); | ^^^^^^^^ error[E0787]: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:86:5 + --> $DIR/naked-functions.rs:85:5 | LL | asm!(""); | ^^^^^^^^ error[E0787]: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:88:5 + --> $DIR/naked-functions.rs:87:5 | LL | asm!(""); | ^^^^^^^^ error[E0787]: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:82:1 + --> $DIR/naked-functions.rs:81:1 | LL | / pub extern "C" fn too_many_asm_blocks() { LL | | @@ -163,7 +163,7 @@ LL | | } | |_^ error: referencing function parameters is not allowed in naked functions - --> $DIR/naked-functions.rs:97:11 + --> $DIR/naked-functions.rs:96:11 | LL | *&y | ^ @@ -171,7 +171,7 @@ LL | *&y = help: follow the calling convention in asm block to use parameters error[E0787]: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:95:5 + --> $DIR/naked-functions.rs:94:5 | LL | / pub extern "C" fn inner(y: usize) -> usize { LL | | @@ -182,31 +182,31 @@ LL | | } | |_____^ error[E0787]: asm options unsupported in naked functions: `nomem`, `preserves_flags` - --> $DIR/naked-functions.rs:105:5 + --> $DIR/naked-functions.rs:104:5 | LL | asm!("", options(nomem, preserves_flags, noreturn)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0787]: asm options unsupported in naked functions: `nostack`, `pure`, `readonly` - --> $DIR/naked-functions.rs:111:5 + --> $DIR/naked-functions.rs:110:5 | LL | asm!("", options(readonly, nostack), options(pure)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0787]: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:111:5 + --> $DIR/naked-functions.rs:110:5 | LL | asm!("", options(readonly, nostack), options(pure)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0787]: asm options unsupported in naked functions: `may_unwind` - --> $DIR/naked-functions.rs:119:5 + --> $DIR/naked-functions.rs:118:5 | LL | asm!("", options(noreturn, may_unwind)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: Rust ABI is unsupported in naked functions - --> $DIR/naked-functions.rs:124:15 + --> $DIR/naked-functions.rs:123:15 | LL | pub unsafe fn default_abi() { | ^^^^^^^^^^^ @@ -214,43 +214,43 @@ LL | pub unsafe fn default_abi() { = note: `#[warn(undefined_naked_function_abi)]` on by default warning: Rust ABI is unsupported in naked functions - --> $DIR/naked-functions.rs:130:15 + --> $DIR/naked-functions.rs:129:29 | -LL | pub unsafe fn rust_abi() { - | ^^^^^^^^ +LL | pub unsafe extern "Rust" fn rust_abi() { + | ^^^^^^^^ error: naked functions cannot be inlined - --> $DIR/naked-functions.rs:170:1 + --> $DIR/naked-functions.rs:169:1 | LL | #[inline] | ^^^^^^^^^ error: naked functions cannot be inlined - --> $DIR/naked-functions.rs:177:1 + --> $DIR/naked-functions.rs:176:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ error: naked functions cannot be inlined - --> $DIR/naked-functions.rs:184:1 + --> $DIR/naked-functions.rs:183:1 | LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ error: naked functions cannot be inlined - --> $DIR/naked-functions.rs:191:1 + --> $DIR/naked-functions.rs:190:1 | LL | #[inline] | ^^^^^^^^^ error: naked functions cannot be inlined - --> $DIR/naked-functions.rs:193:1 + --> $DIR/naked-functions.rs:192:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ error: naked functions cannot be inlined - --> $DIR/naked-functions.rs:195:1 + --> $DIR/naked-functions.rs:194:1 | LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/asm/naked-invalid-attr.rs b/src/test/ui/asm/naked-invalid-attr.rs index ea8f560ff5d9e..33e57ba1e56f9 100644 --- a/src/test/ui/asm/naked-invalid-attr.rs +++ b/src/test/ui/asm/naked-invalid-attr.rs @@ -1,7 +1,7 @@ // Checks that #[naked] attribute can be placed on function definitions only. // // needs-asm-support -#![feature(naked_functions)] + #![naked] //~ ERROR should be applied to a function definition use std::arch::asm; diff --git a/src/test/ui/asm/named-asm-labels.rs b/src/test/ui/asm/named-asm-labels.rs index 160dbf617c4f6..584bc8c640e1c 100644 --- a/src/test/ui/asm/named-asm-labels.rs +++ b/src/test/ui/asm/named-asm-labels.rs @@ -11,7 +11,7 @@ // which causes less readable LLVM errors and in the worst cases causes ICEs // or segfaults based on system dependent behavior and codegen flags. -#![feature(naked_functions, asm_const)] +#![feature(asm_const)] use std::arch::{asm, global_asm}; diff --git a/src/test/ui/feature-gates/feature-gate-naked_functions.rs b/src/test/ui/feature-gates/feature-gate-naked_functions.rs deleted file mode 100644 index 8e93b194174ff..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-naked_functions.rs +++ /dev/null @@ -1,17 +0,0 @@ -// needs-asm-support - -use std::arch::asm; - -#[naked] -//~^ the `#[naked]` attribute is an experimental feature -extern "C" fn naked() { - asm!("", options(noreturn)) -} - -#[naked] -//~^ the `#[naked]` attribute is an experimental feature -extern "C" fn naked_2() -> isize { - asm!("", options(noreturn)) -} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-naked_functions.stderr b/src/test/ui/feature-gates/feature-gate-naked_functions.stderr deleted file mode 100644 index 4378fb36367ad..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-naked_functions.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: the `#[naked]` attribute is an experimental feature - --> $DIR/feature-gate-naked_functions.rs:5:1 - | -LL | #[naked] - | ^^^^^^^^ - | - = note: see issue #32408 for more information - = help: add `#![feature(naked_functions)]` to the crate attributes to enable - -error[E0658]: the `#[naked]` attribute is an experimental feature - --> $DIR/feature-gate-naked_functions.rs:11:1 - | -LL | #[naked] - | ^^^^^^^^ - | - = note: see issue #32408 for more information - = help: add `#![feature(naked_functions)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs index 0045d608133a6..5cd44f1093b5f 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs +++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs @@ -1,5 +1,4 @@ // needs-asm-support -#![feature(naked_functions)] use std::arch::asm; diff --git a/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr b/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr index d33aecc0f97bf..52ff2dd6b82ab 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr +++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr @@ -1,11 +1,11 @@ error[E0736]: cannot use `#[track_caller]` with `#[naked]` - --> $DIR/error-with-naked.rs:6:1 + --> $DIR/error-with-naked.rs:5:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ error[E0736]: cannot use `#[track_caller]` with `#[naked]` - --> $DIR/error-with-naked.rs:15:5 + --> $DIR/error-with-naked.rs:14:5 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simple_global_asm.rs b/src/test/ui/simple_global_asm.rs index 3c69379ff1459..45ad1a43276fd 100644 --- a/src/test/ui/simple_global_asm.rs +++ b/src/test/ui/simple_global_asm.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(naked_functions)] #![allow(dead_code)] #[cfg(any(target_arch = "x86_64", target_arch = "x86"))]