Compare-and-swap methods on the atomic types in core::sync::atomic seem to be gated by #[cfg(target_has_atomic = "cas")] to only define them on targets that support CAS in hardware. However compare_exchange_weak isn't gated at all. This looks like an oversight, if the intention is to never define those methods if the target doesn't actually support them.
N.b. on at least the thumbv6m-none-eabi target, compare_exchange_weak compiles to calls to the same internal functions (__sync_val_compare_and_swap_4 and similar, presumably in compiler-rt or something) as compare_exchange.
Compare-and-swap methods on the atomic types in
core::sync::atomicseem to be gated by#[cfg(target_has_atomic = "cas")]to only define them on targets that support CAS in hardware. Howevercompare_exchange_weakisn't gated at all. This looks like an oversight, if the intention is to never define those methods if the target doesn't actually support them.N.b. on at least the thumbv6m-none-eabi target,
compare_exchange_weakcompiles to calls to the same internal functions (__sync_val_compare_and_swap_4and similar, presumably in compiler-rt or something) ascompare_exchange.