Skip to content

Commit cbbddf6

Browse files
authored
Rollup merge of rust-lang#141687 - RalfJung:atomic_compare_exchange, r=bjorn3
core: unstably expose atomic_compare_exchange so stdarch can use it Due to rust-lang/stdarch#1655, cleaning up the atomic intrinsics will be a bunch of extra work: stdarch directly calls them [here](https://github.com/rust-lang/stdarch/blob/8764244589373b8b48864c0ad11fd9233c672249/crates/core_arch/src/x86_64/cmpxchg16b.rs#L58-L74). Instead of duplicating that match, stdarch should use what we have in libcore, so let's expose that. r? `@bjorn3`
2 parents 593dd85 + e2a7b41 commit cbbddf6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/sync/atomic.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3885,10 +3885,13 @@ unsafe fn atomic_sub<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
38853885
}
38863886
}
38873887

3888+
/// Publicly exposed for stdarch; nobody else should use this.
38883889
#[inline]
38893890
#[cfg(target_has_atomic)]
38903891
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
3891-
unsafe fn atomic_compare_exchange<T: Copy>(
3892+
#[unstable(feature = "core_intrinsics", issue = "none")]
3893+
#[doc(hidden)]
3894+
pub unsafe fn atomic_compare_exchange<T: Copy>(
38923895
dst: *mut T,
38933896
old: T,
38943897
new: T,

0 commit comments

Comments
 (0)