Skip to content

Commit 34386b3

Browse files
committed
Stabilize naked_functions
This stabilizes the feature described in RFC 2972, which supersedes the earlier RFC 1201. Closes #32408 Closes #90957
1 parent 250384e commit 34386b3

20 files changed

+47
-94
lines changed

compiler/rustc_error_codes/src/error_codes/E0787.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ An unsupported naked function definition.
33
Erroneous code example:
44

55
```compile_fail,E0787
6-
#![feature(naked_functions)]
7-
86
#[naked]
97
pub extern "C" fn f() -> u32 {
108
42

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ declare_features! (
203203
/// Allows patterns with concurrent by-move and by-ref bindings.
204204
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
205205
(accepted, move_ref_pattern, "1.49.0", Some(68354), None),
206+
/// Allows using `#[naked]` on functions.
207+
(accepted, naked_functions, "1.60.0", Some(90957), None),
206208
/// Allows using `#![no_std]`.
207209
(accepted, no_std, "1.6.0", None, None),
208210
/// Allows defining identifiers beyond ASCII.

compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,6 @@ declare_features! (
435435
(active, more_qualified_paths, "1.54.0", Some(86935), None),
436436
/// Allows the `#[must_not_suspend]` attribute.
437437
(active, must_not_suspend, "1.57.0", Some(83310), None),
438-
/// Allows using `#[naked]` on functions.
439-
(active, naked_functions, "1.9.0", Some(32408), None),
440438
/// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]`
441439
(active, native_link_modifiers, "1.53.0", Some(81490), None),
442440
/// Allows specifying the as-needed link modifier

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
360360
// Code generation:
361361
ungated!(inline, Normal, template!(Word, List: "always|never"), FutureWarnFollowing),
362362
ungated!(cold, Normal, template!(Word), WarnFollowing),
363+
ungated!(naked, Normal, template!(Word), WarnFollowing),
363364
ungated!(no_builtins, CrateLevel, template!(Word), WarnFollowing),
364365
ungated!(target_feature, Normal, template!(List: r#"enable = "name""#), DuplicatesOk),
365366
ungated!(track_caller, Normal, template!(Word), WarnFollowing),
@@ -379,7 +380,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
379380
// ==========================================================================
380381

381382
// Linking:
382-
gated!(naked, Normal, template!(Word), WarnFollowing, naked_functions, experimental!(naked)),
383383
gated!(
384384
link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, raw_dylib,
385385
experimental!(link_ordinal)

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,8 +2745,6 @@ declare_lint! {
27452745
/// ### Example
27462746
///
27472747
/// ```rust
2748-
/// #![feature(naked_functions)]
2749-
///
27502748
/// use std::arch::asm;
27512749
///
27522750
/// #[naked]

src/doc/unstable-book/src/compiler-flags/sanitizer.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
199199
## Example
200200
201201
```text
202-
#![feature(naked_functions)]
203-
204202
use std::arch::asm;
205203
use std::mem;
206204

src/test/codegen/naked-functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// only-x86_64
44

55
#![crate_type = "lib"]
6-
#![feature(naked_functions)]
6+
77
use std::arch::asm;
88

99
// CHECK: Function Attrs: naked

src/test/codegen/naked-noinline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// compile-flags: -O -Zmir-opt-level=3
33
// needs-asm-support
44
// ignore-wasm32
5+
56
#![crate_type = "lib"]
6-
#![feature(naked_functions)]
77

88
use std::arch::asm;
99

src/test/ui/asm/naked-functions-ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// check-pass
22
// needs-asm-support
3-
#![feature(naked_functions)]
3+
44
#![crate_type = "lib"]
55

66
use std::arch::asm;

src/test/ui/asm/naked-functions-unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// revisions: x86_64 aarch64
22
//[x86_64] only-x86_64
33
//[aarch64] only-aarch64
4+
45
#![deny(unused)]
5-
#![feature(naked_functions)]
66
#![crate_type = "lib"]
77

88
pub trait Trait {

0 commit comments

Comments
 (0)