Skip to content

Commit a898f41

Browse files
committed
Only enable new cmpxchg memory orderings in cfg(not(bootstrap)).
(The bootstrap/beta compiler doesn't support them yet.)
1 parent a7434da commit a898f41

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

library/core/src/sync/atomic.rs

+16
Original file line numberDiff line numberDiff line change
@@ -2649,22 +2649,30 @@ unsafe fn atomic_compare_exchange<T: Copy>(
26492649
let (val, ok) = unsafe {
26502650
match (success, failure) {
26512651
(Relaxed, Relaxed) => intrinsics::atomic_cxchg_relaxed_relaxed(dst, old, new),
2652+
#[cfg(not(bootstrap))]
26522653
(Relaxed, Acquire) => intrinsics::atomic_cxchg_relaxed_acquire(dst, old, new),
2654+
#[cfg(not(bootstrap))]
26532655
(Relaxed, SeqCst) => intrinsics::atomic_cxchg_relaxed_seqcst(dst, old, new),
26542656
(Acquire, Relaxed) => intrinsics::atomic_cxchg_acquire_relaxed(dst, old, new),
26552657
(Acquire, Acquire) => intrinsics::atomic_cxchg_acquire_acquire(dst, old, new),
2658+
#[cfg(not(bootstrap))]
26562659
(Acquire, SeqCst) => intrinsics::atomic_cxchg_acquire_seqcst(dst, old, new),
26572660
(Release, Relaxed) => intrinsics::atomic_cxchg_release_relaxed(dst, old, new),
2661+
#[cfg(not(bootstrap))]
26582662
(Release, Acquire) => intrinsics::atomic_cxchg_release_acquire(dst, old, new),
2663+
#[cfg(not(bootstrap))]
26592664
(Release, SeqCst) => intrinsics::atomic_cxchg_release_seqcst(dst, old, new),
26602665
(AcqRel, Relaxed) => intrinsics::atomic_cxchg_acqrel_relaxed(dst, old, new),
26612666
(AcqRel, Acquire) => intrinsics::atomic_cxchg_acqrel_acquire(dst, old, new),
2667+
#[cfg(not(bootstrap))]
26622668
(AcqRel, SeqCst) => intrinsics::atomic_cxchg_acqrel_seqcst(dst, old, new),
26632669
(SeqCst, Relaxed) => intrinsics::atomic_cxchg_seqcst_relaxed(dst, old, new),
26642670
(SeqCst, Acquire) => intrinsics::atomic_cxchg_seqcst_acquire(dst, old, new),
26652671
(SeqCst, SeqCst) => intrinsics::atomic_cxchg_seqcst_seqcst(dst, old, new),
26662672
(_, AcqRel) => panic!("there is no such thing as an acquire-release failure ordering"),
26672673
(_, Release) => panic!("there is no such thing as a release failure ordering"),
2674+
#[cfg(bootstrap)]
2675+
_ => panic!("a failure ordering can't be stronger than a success ordering"),
26682676
}
26692677
};
26702678
if ok { Ok(val) } else { Err(val) }
@@ -2683,22 +2691,30 @@ unsafe fn atomic_compare_exchange_weak<T: Copy>(
26832691
let (val, ok) = unsafe {
26842692
match (success, failure) {
26852693
(Relaxed, Relaxed) => intrinsics::atomic_cxchgweak_relaxed_relaxed(dst, old, new),
2694+
#[cfg(not(bootstrap))]
26862695
(Relaxed, Acquire) => intrinsics::atomic_cxchgweak_relaxed_acquire(dst, old, new),
2696+
#[cfg(not(bootstrap))]
26872697
(Relaxed, SeqCst) => intrinsics::atomic_cxchgweak_relaxed_seqcst(dst, old, new),
26882698
(Acquire, Relaxed) => intrinsics::atomic_cxchgweak_acquire_relaxed(dst, old, new),
26892699
(Acquire, Acquire) => intrinsics::atomic_cxchgweak_acquire_acquire(dst, old, new),
2700+
#[cfg(not(bootstrap))]
26902701
(Acquire, SeqCst) => intrinsics::atomic_cxchgweak_acquire_seqcst(dst, old, new),
26912702
(Release, Relaxed) => intrinsics::atomic_cxchgweak_release_relaxed(dst, old, new),
2703+
#[cfg(not(bootstrap))]
26922704
(Release, Acquire) => intrinsics::atomic_cxchgweak_release_acquire(dst, old, new),
2705+
#[cfg(not(bootstrap))]
26932706
(Release, SeqCst) => intrinsics::atomic_cxchgweak_release_seqcst(dst, old, new),
26942707
(AcqRel, Relaxed) => intrinsics::atomic_cxchgweak_acqrel_relaxed(dst, old, new),
26952708
(AcqRel, Acquire) => intrinsics::atomic_cxchgweak_acqrel_acquire(dst, old, new),
2709+
#[cfg(not(bootstrap))]
26962710
(AcqRel, SeqCst) => intrinsics::atomic_cxchgweak_acqrel_seqcst(dst, old, new),
26972711
(SeqCst, Relaxed) => intrinsics::atomic_cxchgweak_seqcst_relaxed(dst, old, new),
26982712
(SeqCst, Acquire) => intrinsics::atomic_cxchgweak_seqcst_acquire(dst, old, new),
26992713
(SeqCst, SeqCst) => intrinsics::atomic_cxchgweak_seqcst_seqcst(dst, old, new),
27002714
(_, AcqRel) => panic!("there is no such thing as an acquire-release failure ordering"),
27012715
(_, Release) => panic!("there is no such thing as a release failure ordering"),
2716+
#[cfg(bootstrap)]
2717+
_ => panic!("a failure ordering can't be stronger than a success ordering"),
27022718
}
27032719
};
27042720
if ok { Ok(val) } else { Err(val) }

0 commit comments

Comments
 (0)