Skip to content

Commit 614599c

Browse files
committed
Stabilize asm! and global_asm!
They are also removed from the prelude as per the decision in rust-lang#87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros.
1 parent 2a9aa72 commit 614599c

File tree

13 files changed

+20
-63
lines changed

13 files changed

+20
-63
lines changed

core/src/lib.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@
152152
#![feature(abi_unadjusted)]
153153
#![feature(allow_internal_unsafe)]
154154
#![feature(allow_internal_unstable)]
155-
#![feature(asm)]
156155
#![feature(associated_type_bounds)]
157156
#![feature(auto_traits)]
158157
#![feature(cfg_target_has_atomic)]
@@ -372,26 +371,14 @@ pub mod arch {
372371
pub use crate::core_arch::arch::*;
373372

374373
/// Inline assembly.
375-
///
376-
/// Read the [unstable book] for the usage.
377-
///
378-
/// [unstable book]: ../../unstable-book/library-features/asm.html
379-
#[unstable(
380-
feature = "asm",
381-
issue = "72016",
382-
reason = "inline assembly is not stable enough for use and is subject to change"
383-
)]
374+
#[stable(feature = "asm", since = "1.59.0")]
384375
#[rustc_builtin_macro]
385376
pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
386377
/* compiler built-in */
387378
}
388379
389380
/// Module-level inline assembly.
390-
#[unstable(
391-
feature = "global_asm",
392-
issue = "35119",
393-
reason = "`global_asm!` is not stable enough for use and is subject to change"
394-
)]
381+
#[stable(feature = "global_asm", since = "1.59.0")]
395382
#[rustc_builtin_macro]
396383
pub macro global_asm("assembly template", $(operands,)* $(options($(option),*))?) {
397384
/* compiler built-in */

core/src/num/dec2flt/fpu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub use fpu_precision::set_precision;
1010
// computations are performed in the desired precision.
1111
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]
1212
mod fpu_precision {
13+
use core::arch::asm;
1314
use core::mem::size_of;
1415

1516
/// A structure used to preserve the original value of the FPU control word, so that it can be

core/src/prelude/v1.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,6 @@ pub use crate::{
6969
#[doc(no_inline)]
7070
pub use crate::concat_bytes;
7171

72-
#[unstable(
73-
feature = "asm",
74-
issue = "72016",
75-
reason = "inline assembly is not stable enough for use and is subject to change"
76-
)]
77-
#[doc(no_inline)]
78-
pub use crate::arch::asm;
79-
80-
#[unstable(
81-
feature = "global_asm",
82-
issue = "35119",
83-
reason = "`global_asm!` is not stable enough for use and is subject to change"
84-
)]
85-
#[doc(no_inline)]
86-
pub use crate::arch::global_asm;
87-
8872
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
8973
#[allow(deprecated, deprecated_in_future)]
9074
#[doc(no_inline)]

panic_abort/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![feature(std_internals)]
1515
#![feature(staged_api)]
1616
#![feature(rustc_attrs)]
17-
#![feature(asm)]
1817
#![feature(c_unwind)]
1918

2019
#[cfg(target_os = "android")]
@@ -69,11 +68,11 @@ pub unsafe extern "C-unwind" fn __rust_start_panic(_payload: *mut &mut dyn BoxMe
6968
const FAST_FAIL_FATAL_APP_EXIT: usize = 7;
7069
cfg_if::cfg_if! {
7170
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
72-
asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT);
71+
core::arch::asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT);
7372
} else if #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] {
74-
asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT);
73+
core::arch::asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT);
7574
} else if #[cfg(target_arch = "aarch64")] {
76-
asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT);
75+
core::arch::asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT);
7776
} else {
7877
core::intrinsics::abort();
7978
}

std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ panic_unwind = { path = "../panic_unwind", optional = true }
1616
panic_abort = { path = "../panic_abort" }
1717
core = { path = "../core" }
1818
libc = { version = "0.2.108", default-features = false, features = ['rustc-dep-of-std'] }
19-
compiler_builtins = { version = "0.1.55" }
19+
compiler_builtins = { version = "0.1.65" }
2020
profiler_builtins = { path = "../profiler_builtins", optional = true }
2121
unwind = { path = "../unwind" }
2222
hashbrown = { version = "0.11", default-features = false, features = ['rustc-dep-of-std'] }

std/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@
233233
#![feature(allow_internal_unstable)]
234234
#![feature(arbitrary_self_types)]
235235
#![feature(array_error_internals)]
236-
#![feature(asm)]
237236
#![feature(assert_matches)]
238237
#![feature(associated_type_bounds)]
239238
#![feature(async_stream)]
@@ -288,7 +287,6 @@
288287
#![feature(gen_future)]
289288
#![feature(generator_trait)]
290289
#![feature(get_mut_unchecked)]
291-
#![feature(global_asm)]
292290
#![feature(hashmap_internals)]
293291
#![feature(int_error_internals)]
294292
#![feature(integer_atomics)]

std/src/os/fortanix_sgx/arch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![unstable(feature = "sgx_platform", issue = "56975")]
66

77
use crate::mem::MaybeUninit;
8+
use core::arch::asm;
89

910
/// Wrapper struct to force 16-byte alignment.
1011
#[repr(align(16))]

std/src/prelude/v1.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,6 @@ pub use core::prelude::v1::{
5454
#[doc(no_inline)]
5555
pub use core::prelude::v1::concat_bytes;
5656

57-
#[unstable(
58-
feature = "asm",
59-
issue = "72016",
60-
reason = "inline assembly is not stable enough for use and is subject to change"
61-
)]
62-
#[doc(no_inline)]
63-
pub use core::prelude::v1::asm;
64-
65-
#[unstable(
66-
feature = "global_asm",
67-
issue = "35119",
68-
reason = "`global_asm!` is not stable enough for use and is subject to change"
69-
)]
70-
#[doc(no_inline)]
71-
pub use core::prelude::v1::global_asm;
72-
7357
// FIXME: Attribute and internal derive macros are not documented because for them rustdoc generates
7458
// dead links which fail link checker testing.
7559
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]

std/src/sys/sgx/abi/mem.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use core::arch::asm;
2+
13
// Do not remove inline: will result in relocation failure
24
#[inline(always)]
35
pub(crate) unsafe fn rel_ptr<T>(offset: u64) -> *const T {

std/src/sys/sgx/abi/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg_attr(test, allow(unused))] // RT initialization logic is not compiled for test
22

33
use crate::io::Write;
4+
use core::arch::global_asm;
45
use core::sync::atomic::{AtomicUsize, Ordering};
56

67
// runtime features

0 commit comments

Comments
 (0)