Skip to content

Commit ae2fa18

Browse files
committed
stabilize naked_functions
1 parent 6afee11 commit ae2fa18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+150
-279
lines changed

compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
#![feature(
2-
no_core,
3-
lang_items,
4-
never_type,
5-
linkage,
6-
extern_types,
7-
naked_functions,
8-
thread_local,
9-
repr_simd
10-
)]
1+
#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)]
112
#![no_core]
123
#![allow(dead_code, non_camel_case_types, internal_features)]
134

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
@@ -299,6 +299,8 @@ declare_features! (
299299
/// Allows patterns with concurrent by-move and by-ref bindings.
300300
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
301301
(accepted, move_ref_pattern, "1.49.0", Some(68354)),
302+
/// Allows using `#[naked]` on functions.
303+
(accepted, naked_functions, "CURRENT_RUSTC_VERSION", Some(90957)),
302304
/// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]`
303305
(accepted, native_link_modifiers, "1.61.0", Some(81490)),
304306
/// Allows specifying the bundle link modifier

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
432432
ungated!(unsafe no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
433433
ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, EncodeCrossCrate::No),
434434
ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, EncodeCrossCrate::Yes),
435+
ungated!(naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
435436

436437
// Limits:
437438
ungated!(
@@ -506,12 +507,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
506507
// Unstable attributes:
507508
// ==========================================================================
508509

509-
// Linking:
510-
gated!(
511-
naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
512-
naked_functions, experimental!(naked)
513-
),
514-
515510
// Testing:
516511
gated!(
517512
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing,

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,6 @@ declare_features! (
554554
(unstable, must_not_suspend, "1.57.0", Some(83310)),
555555
/// Allows `mut ref` and `mut ref mut` identifier patterns.
556556
(incomplete, mut_ref, "1.79.0", Some(123076)),
557-
/// Allows using `#[naked]` on functions.
558-
(unstable, naked_functions, "1.9.0", Some(90957)),
559557
/// Allows specifying the as-needed link modifier
560558
(unstable, native_link_modifiers_as_needed, "1.53.0", Some(81490)),
561559
/// Allow negative trait implementations.

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2923,7 +2923,7 @@ declare_lint! {
29232923
/// ### Example
29242924
///
29252925
/// ```rust
2926-
/// #![feature(asm_experimental_arch, naked_functions)]
2926+
/// #![feature(asm_experimental_arch)]
29272927
///
29282928
/// use std::arch::naked_asm;
29292929
///

library/core/src/arch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
2424
///
2525
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
2626
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
27-
#[unstable(feature = "naked_functions", issue = "90957")]
27+
#[stable(feature = "naked_functions", since = "CURRENT_RUSTC_VERSION")]
2828
#[rustc_builtin_macro]
2929
pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) {
3030
/* compiler built-in */

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,7 @@ See the [Clang ControlFlowIntegrity documentation][clang-cfi] for more details.
245245
## Example 1: Redirecting control flow using an indirect branch/call to an invalid destination
246246
247247
```rust,ignore (making doc tests pass cross-platform is hard)
248-
#![feature(naked_functions)]
249-
250-
use std::arch::asm;
248+
use std::arch::naked_asm;
251249
use std::mem;
252250

253251
fn add_one(x: i32) -> i32 {
@@ -258,7 +256,7 @@ fn add_one(x: i32) -> i32 {
258256
pub extern "C" fn add_two(x: i32) {
259257
// x + 2 preceded by a landing pad/nop block
260258
unsafe {
261-
asm!(
259+
naked_asm!(
262260
"
263261
nop
264262
nop

src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
195195
ungated!(no_mangle, Normal, template!(Word), WarnFollowing, @only_local: true),
196196
ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, @only_local: true),
197197
ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding),
198+
ungated!(naked, Normal, template!(Word), WarnFollowing, @only_local: true),
198199

199200
// Limits:
200201
ungated!(recursion_limit, CrateLevel, template!(NameValueStr: "N"), FutureWarnFollowing),
@@ -253,12 +254,6 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
253254
// Unstable attributes:
254255
// ==========================================================================
255256

256-
// Linking:
257-
gated!(
258-
naked, Normal, template!(Word), WarnFollowing, @only_local: true,
259-
naked_functions, experimental!(naked)
260-
),
261-
262257
// Testing:
263258
gated!(
264259
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing, custom_test_frameworks,

tests/assembly/aarch64-naked-fn-no-bti-prolog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//@ only-aarch64
55

66
#![crate_type = "lib"]
7-
#![feature(naked_functions)]
7+
88
use std::arch::naked_asm;
99

1010
// The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",

0 commit comments

Comments
 (0)