about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2021-12-10 00:15:33 +0000
committerAmanieu d'Antras <amanieu@gmail.com>2021-12-12 11:20:03 +0000
commit44a3a66ee890545a2c1ac78ff8f107fe5e7204f9 (patch)
tree8821e53e6c339fca0b3fc58e34fc702a0866d087 /library/std/src
parentb3a55371a72f665f5d9476d07980e76d3e755fe6 (diff)
Stabilize asm! and global_asm!
They are also removed from the prelude as per the decision in
https://github.com/rust-lang/rust/issues/87228.

stdarch and compiler-builtins are updated to work with the new, stable
asm! and global_asm! macros.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/lib.rs2
-rw-r--r--library/std/src/os/fortanix_sgx/arch.rs1
-rw-r--r--library/std/src/prelude/v1.rs16
-rw-r--r--library/std/src/sys/sgx/abi/mem.rs2
-rw-r--r--library/std/src/sys/sgx/abi/mod.rs1
-rw-r--r--library/std/src/sys/solid/abi/mod.rs10
-rw-r--r--library/std/src/sys/windows/mod.rs6
7 files changed, 12 insertions, 26 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index d4ff642cd13..b725fc8bd52 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -233,7 +233,6 @@
 #![feature(allow_internal_unstable)]
 #![feature(arbitrary_self_types)]
 #![feature(array_error_internals)]
-#![feature(asm)]
 #![feature(assert_matches)]
 #![feature(associated_type_bounds)]
 #![feature(async_stream)]
@@ -288,7 +287,6 @@
 #![feature(gen_future)]
 #![feature(generator_trait)]
 #![feature(get_mut_unchecked)]
-#![feature(global_asm)]
 #![feature(hashmap_internals)]
 #![feature(int_error_internals)]
 #![feature(integer_atomics)]
diff --git a/library/std/src/os/fortanix_sgx/arch.rs b/library/std/src/os/fortanix_sgx/arch.rs
index 4ce482e23cb..8358cb9e81b 100644
--- a/library/std/src/os/fortanix_sgx/arch.rs
+++ b/library/std/src/os/fortanix_sgx/arch.rs
@@ -5,6 +5,7 @@
 #![unstable(feature = "sgx_platform", issue = "56975")]
 
 use crate::mem::MaybeUninit;
+use core::arch::asm;
 
 /// Wrapper struct to force 16-byte alignment.
 #[repr(align(16))]
diff --git a/library/std/src/prelude/v1.rs b/library/std/src/prelude/v1.rs
index 9b23aa37e31..743dd51333d 100644
--- a/library/std/src/prelude/v1.rs
+++ b/library/std/src/prelude/v1.rs
@@ -54,22 +54,6 @@ pub use core::prelude::v1::{
 #[doc(no_inline)]
 pub use core::prelude::v1::concat_bytes;
 
-#[unstable(
-    feature = "asm",
-    issue = "72016",
-    reason = "inline assembly is not stable enough for use and is subject to change"
-)]
-#[doc(no_inline)]
-pub use core::prelude::v1::asm;
-
-#[unstable(
-    feature = "global_asm",
-    issue = "35119",
-    reason = "`global_asm!` is not stable enough for use and is subject to change"
-)]
-#[doc(no_inline)]
-pub use core::prelude::v1::global_asm;
-
 // FIXME: Attribute and internal derive macros are not documented because for them rustdoc generates
 // dead links which fail link checker testing.
 #[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
diff --git a/library/std/src/sys/sgx/abi/mem.rs b/library/std/src/sys/sgx/abi/mem.rs
index 52e8bec937c..18e6d5b3fa2 100644
--- a/library/std/src/sys/sgx/abi/mem.rs
+++ b/library/std/src/sys/sgx/abi/mem.rs
@@ -1,3 +1,5 @@
+use core::arch::asm;
+
 // Do not remove inline: will result in relocation failure
 #[inline(always)]
 pub(crate) unsafe fn rel_ptr<T>(offset: u64) -> *const T {
diff --git a/library/std/src/sys/sgx/abi/mod.rs b/library/std/src/sys/sgx/abi/mod.rs
index 231cc15b849..5df08a4ff59 100644
--- a/library/std/src/sys/sgx/abi/mod.rs
+++ b/library/std/src/sys/sgx/abi/mod.rs
@@ -1,6 +1,7 @@
 #![cfg_attr(test, allow(unused))] // RT initialization logic is not compiled for test
 
 use crate::io::Write;
+use core::arch::global_asm;
 use core::sync::atomic::{AtomicUsize, Ordering};
 
 // runtime features
diff --git a/library/std/src/sys/solid/abi/mod.rs b/library/std/src/sys/solid/abi/mod.rs
index 3205f0db85f..bbbee4fd6d1 100644
--- a/library/std/src/sys/solid/abi/mod.rs
+++ b/library/std/src/sys/solid/abi/mod.rs
@@ -10,9 +10,9 @@ pub fn breakpoint_program_exited(tid: usize) {
         match () {
             // SOLID_BP_PROGRAM_EXITED = 15
             #[cfg(target_arch = "arm")]
-            () => asm!("bkpt #15", in("r0") tid),
-            #[cfg(target_arch = "aarch64")]
-            () => asm!("hlt #15", in("x0") tid),
+            () => core::arch::asm!("bkpt #15", in("r0") tid),
+            #[cfg(core::arch::asm = "aarch64")]
+            () => core::arch::asm!("hlt #15", in("x0") tid),
         }
     }
 }
@@ -23,9 +23,9 @@ pub fn breakpoint_abort() {
         match () {
             // SOLID_BP_CSABORT = 16
             #[cfg(target_arch = "arm")]
-            () => asm!("bkpt #16"),
+            () => core::arch::asm!("bkpt #16"),
             #[cfg(target_arch = "aarch64")]
-            () => asm!("hlt #16"),
+            () => core::arch::asm!("hlt #16"),
         }
     }
 }
diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs
index 28fec817f86..084af4325e7 100644
--- a/library/std/src/sys/windows/mod.rs
+++ b/library/std/src/sys/windows/mod.rs
@@ -288,13 +288,13 @@ pub fn abort_internal() -> ! {
     unsafe {
         cfg_if::cfg_if! {
             if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
-                asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT);
+                core::arch::asm!("int $$0x29", in("ecx") FAST_FAIL_FATAL_APP_EXIT);
                 crate::intrinsics::unreachable();
             } else if #[cfg(all(target_arch = "arm", target_feature = "thumb-mode"))] {
-                asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT);
+                core::arch::asm!(".inst 0xDEFB", in("r0") FAST_FAIL_FATAL_APP_EXIT);
                 crate::intrinsics::unreachable();
             } else if #[cfg(target_arch = "aarch64")] {
-                asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT);
+                core::arch::asm!("brk 0xF003", in("x0") FAST_FAIL_FATAL_APP_EXIT);
                 crate::intrinsics::unreachable();
             }
         }