diff options
| author | bors <bors@rust-lang.org> | 2023-12-03 05:03:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-03 05:03:12 +0000 |
| commit | 2f1ba4a0afde1bd3c2dfd600ca365eeff2f6fea9 (patch) | |
| tree | 0d122498e21b1895bcbae39f432d2bee1191895b /library/core/src | |
| parent | 225e36cff9809948d6567ab16f75d7b087ea83a7 (diff) | |
| parent | 79ad512ec0de1265c21cbd943f2273449f7e874d (diff) | |
| download | rust-2f1ba4a0afde1bd3c2dfd600ca365eeff2f6fea9.tar.gz rust-2f1ba4a0afde1bd3c2dfd600ca365eeff2f6fea9.zip | |
Auto merge of #118128 - RalfJung:bad-intrinsics, r=the8472
warn against using intrinsics that leave the scope of our memory model
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/intrinsics.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index f25ca9e2b18..214c8e49a5a 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -341,6 +341,9 @@ extern "rust-intrinsic" { /// [`Ordering::Relaxed`] as the `order`. For example, [`AtomicBool::load`]. #[rustc_nounwind] pub fn atomic_load_relaxed<T: Copy>(src: *const T) -> T; + /// Do NOT use this intrinsic; "unordered" operations do not exist in our memory model! + /// In terms of the Rust Abstract Machine, this operation is equivalent to `src.read()`, + /// i.e., it performs a non-atomic read. #[rustc_nounwind] pub fn atomic_load_unordered<T: Copy>(src: *const T) -> T; @@ -365,6 +368,9 @@ extern "rust-intrinsic" { /// [`Ordering::Relaxed`] as the `order`. For example, [`AtomicBool::store`]. #[rustc_nounwind] pub fn atomic_store_relaxed<T: Copy>(dst: *mut T, val: T); + /// Do NOT use this intrinsic; "unordered" operations do not exist in our memory model! + /// In terms of the Rust Abstract Machine, this operation is equivalent to `dst.write(val)`, + /// i.e., it performs a non-atomic write. #[rustc_nounwind] pub fn atomic_store_unordered<T: Copy>(dst: *mut T, val: T); @@ -2312,6 +2318,10 @@ extern "rust-intrinsic" { /// Emits a `!nontemporal` store according to LLVM (see their docs). /// Probably will never become stable. + /// + /// Do NOT use this intrinsic; "nontemporal" operations do not exist in our memory model! + /// It exists to support current stdarch, but the plan is to change stdarch and remove this intrinsic. + /// See <https://github.com/rust-lang/rust/issues/114582> for some more discussion. #[rustc_nounwind] pub fn nontemporal_store<T>(ptr: *mut T, val: T); |
