Skip to content

Commit 6b0d0b0

Browse files
committed
avoid using core_intrinsics feature (for a transition)
1 parent 302f01e commit 6b0d0b0

File tree

1 file changed

+152
-2
lines changed

1 file changed

+152
-2
lines changed

crates/core_arch/src/lib.rs

+152-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
simd_ffi,
1313
proc_macro_hygiene,
1414
stmt_expr_attributes,
15-
core_intrinsics,
1615
intrinsics,
1716
no_core,
1817
rustc_attrs,
@@ -85,4 +84,155 @@ pub mod arch {
8584
}
8685

8786
#[allow(unused_imports)]
88-
use core::{convert, ffi, hint, intrinsics, marker, mem, ops, ptr, sync};
87+
use core::{convert, ffi, hint, marker, mem, ops, ptr, sync};
88+
89+
// `core` is changing the feature name for the `intrinsics` module.
90+
// To permit that transition, we avoid using that feature for now.
91+
mod intrinsics {
92+
extern "rust-intrinsic" {
93+
/// Emits a `!nontemporal` store according to LLVM (see their docs).
94+
/// Probably will never become stable.
95+
#[rustc_nounwind]
96+
pub fn nontemporal_store<T>(ptr: *mut T, val: T);
97+
98+
/// Aborts the execution of the process.
99+
///
100+
/// Note that, unlike most intrinsics, this is safe to call;
101+
/// it does not require an `unsafe` block.
102+
/// Therefore, implementations must not require the user to uphold
103+
/// any safety invariants.
104+
///
105+
/// [`std::process::abort`](../../std/process/fn.abort.html) is to be preferred if possible,
106+
/// as its behavior is more user-friendly and more stable.
107+
///
108+
/// The current implementation of `intrinsics::abort` is to invoke an invalid instruction,
109+
/// on most platforms.
110+
/// On Unix, the
111+
/// process will probably terminate with a signal like `SIGABRT`, `SIGILL`, `SIGTRAP`, `SIGSEGV` or
112+
/// `SIGBUS`. The precise behaviour is not guaranteed and not stable.
113+
#[rustc_safe_intrinsic]
114+
#[rustc_nounwind]
115+
pub fn abort() -> !;
116+
117+
/// Stores a value if the current value is the same as the `old` value.
118+
///
119+
/// The stabilized version of this intrinsic is available on the
120+
/// [`atomic`] types via the `compare_exchange` method by passing
121+
/// [`Ordering::Relaxed`] as both the success and failure parameters.
122+
/// For example, [`AtomicBool::compare_exchange`].
123+
#[rustc_nounwind]
124+
pub fn atomic_cxchg_relaxed_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
125+
/// Stores a value if the current value is the same as the `old` value.
126+
///
127+
/// The stabilized version of this intrinsic is available on the
128+
/// [`atomic`] types via the `compare_exchange` method by passing
129+
/// [`Ordering::Relaxed`] and [`Ordering::Acquire`] as the success and failure parameters.
130+
/// For example, [`AtomicBool::compare_exchange`].
131+
#[rustc_nounwind]
132+
pub fn atomic_cxchg_relaxed_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
133+
/// Stores a value if the current value is the same as the `old` value.
134+
///
135+
/// The stabilized version of this intrinsic is available on the
136+
/// [`atomic`] types via the `compare_exchange` method by passing
137+
/// [`Ordering::Relaxed`] and [`Ordering::SeqCst`] as the success and failure parameters.
138+
/// For example, [`AtomicBool::compare_exchange`].
139+
#[rustc_nounwind]
140+
pub fn atomic_cxchg_relaxed_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
141+
/// Stores a value if the current value is the same as the `old` value.
142+
///
143+
/// The stabilized version of this intrinsic is available on the
144+
/// [`atomic`] types via the `compare_exchange` method by passing
145+
/// [`Ordering::Acquire`] and [`Ordering::Relaxed`] as the success and failure parameters.
146+
/// For example, [`AtomicBool::compare_exchange`].
147+
#[rustc_nounwind]
148+
pub fn atomic_cxchg_acquire_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
149+
/// Stores a value if the current value is the same as the `old` value.
150+
///
151+
/// The stabilized version of this intrinsic is available on the
152+
/// [`atomic`] types via the `compare_exchange` method by passing
153+
/// [`Ordering::Acquire`] as both the success and failure parameters.
154+
/// For example, [`AtomicBool::compare_exchange`].
155+
#[rustc_nounwind]
156+
pub fn atomic_cxchg_acquire_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
157+
/// Stores a value if the current value is the same as the `old` value.
158+
///
159+
/// The stabilized version of this intrinsic is available on the
160+
/// [`atomic`] types via the `compare_exchange` method by passing
161+
/// [`Ordering::Acquire`] and [`Ordering::SeqCst`] as the success and failure parameters.
162+
/// For example, [`AtomicBool::compare_exchange`].
163+
#[rustc_nounwind]
164+
pub fn atomic_cxchg_acquire_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
165+
/// Stores a value if the current value is the same as the `old` value.
166+
///
167+
/// The stabilized version of this intrinsic is available on the
168+
/// [`atomic`] types via the `compare_exchange` method by passing
169+
/// [`Ordering::Release`] and [`Ordering::Relaxed`] as the success and failure parameters.
170+
/// For example, [`AtomicBool::compare_exchange`].
171+
#[rustc_nounwind]
172+
pub fn atomic_cxchg_release_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
173+
/// Stores a value if the current value is the same as the `old` value.
174+
///
175+
/// The stabilized version of this intrinsic is available on the
176+
/// [`atomic`] types via the `compare_exchange` method by passing
177+
/// [`Ordering::Release`] and [`Ordering::Acquire`] as the success and failure parameters.
178+
/// For example, [`AtomicBool::compare_exchange`].
179+
#[rustc_nounwind]
180+
pub fn atomic_cxchg_release_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
181+
/// Stores a value if the current value is the same as the `old` value.
182+
///
183+
/// The stabilized version of this intrinsic is available on the
184+
/// [`atomic`] types via the `compare_exchange` method by passing
185+
/// [`Ordering::Release`] and [`Ordering::SeqCst`] as the success and failure parameters.
186+
/// For example, [`AtomicBool::compare_exchange`].
187+
#[rustc_nounwind]
188+
pub fn atomic_cxchg_release_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
189+
/// Stores a value if the current value is the same as the `old` value.
190+
///
191+
/// The stabilized version of this intrinsic is available on the
192+
/// [`atomic`] types via the `compare_exchange` method by passing
193+
/// [`Ordering::AcqRel`] and [`Ordering::Relaxed`] as the success and failure parameters.
194+
/// For example, [`AtomicBool::compare_exchange`].
195+
#[rustc_nounwind]
196+
pub fn atomic_cxchg_acqrel_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
197+
/// Stores a value if the current value is the same as the `old` value.
198+
///
199+
/// The stabilized version of this intrinsic is available on the
200+
/// [`atomic`] types via the `compare_exchange` method by passing
201+
/// [`Ordering::AcqRel`] and [`Ordering::Acquire`] as the success and failure parameters.
202+
/// For example, [`AtomicBool::compare_exchange`].
203+
#[rustc_nounwind]
204+
pub fn atomic_cxchg_acqrel_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
205+
/// Stores a value if the current value is the same as the `old` value.
206+
///
207+
/// The stabilized version of this intrinsic is available on the
208+
/// [`atomic`] types via the `compare_exchange` method by passing
209+
/// [`Ordering::AcqRel`] and [`Ordering::SeqCst`] as the success and failure parameters.
210+
/// For example, [`AtomicBool::compare_exchange`].
211+
#[rustc_nounwind]
212+
pub fn atomic_cxchg_acqrel_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
213+
/// Stores a value if the current value is the same as the `old` value.
214+
///
215+
/// The stabilized version of this intrinsic is available on the
216+
/// [`atomic`] types via the `compare_exchange` method by passing
217+
/// [`Ordering::SeqCst`] and [`Ordering::Relaxed`] as the success and failure parameters.
218+
/// For example, [`AtomicBool::compare_exchange`].
219+
#[rustc_nounwind]
220+
pub fn atomic_cxchg_seqcst_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
221+
/// Stores a value if the current value is the same as the `old` value.
222+
///
223+
/// The stabilized version of this intrinsic is available on the
224+
/// [`atomic`] types via the `compare_exchange` method by passing
225+
/// [`Ordering::SeqCst`] and [`Ordering::Acquire`] as the success and failure parameters.
226+
/// For example, [`AtomicBool::compare_exchange`].
227+
#[rustc_nounwind]
228+
pub fn atomic_cxchg_seqcst_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
229+
/// Stores a value if the current value is the same as the `old` value.
230+
///
231+
/// The stabilized version of this intrinsic is available on the
232+
/// [`atomic`] types via the `compare_exchange` method by passing
233+
/// [`Ordering::SeqCst`] as both the success and failure parameters.
234+
/// For example, [`AtomicBool::compare_exchange`].
235+
#[rustc_nounwind]
236+
pub fn atomic_cxchg_seqcst_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
237+
}
238+
}

0 commit comments

Comments
 (0)