After updating heapless to 0.8 in my project (as a transitive dependency of usb-device 0.3.2), it fails to build with:
error[E0599]: no method named `fetch_add` found for struct `AtomicUsize` in the current scope
--> src/pool/arc.rs:235:44
|
235 | let old_size = self.inner().strong.fetch_add(1, Ordering::Relaxed);
| ^^^^^^^^^ method not found in `AtomicUsize`
error[E0599]: no method named `fetch_sub` found for struct `AtomicUsize` in the current scope
--> src/pool/arc.rs:282:32
|
282 | if self.inner().strong.fetch_sub(1, Ordering::Release) != 1 {
| ^^^^^^^^^ method not found in `AtomicUsize`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `heapless` (lib) due to 2 previous errors
I noticed in cargo build -v that it was building with --cfg arm_llsc, and tracked this down to my -C linker-plugin-lto=y in RUSTFLAGS. It seems that the asm in ARM_LLSC_PROBE in build.rs gets optimized out and successfully builds in this configuration, despite thumbv6m not supporting atomics.
After updating
heapless
to 0.8 in my project (as a transitive dependency ofusb-device
0.3.2), it fails to build with:I noticed in
cargo build -v
that it was building with--cfg arm_llsc
, and tracked this down to my-C linker-plugin-lto=y
inRUSTFLAGS
. It seems that the asm inARM_LLSC_PROBE
in build.rs gets optimized out and successfully builds in this configuration, despite thumbv6m not supporting atomics.This is reproducible in this repository with