ferrilab / ferrilab

Experimenting with Rust's fundamental data model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bitvec 1.0 fails on esp32 target `xtensa-esp32-none-elf` due to radium 0.7.0

TheButlah opened this issue · comments

The if_atomic! macro in radium 0.7.0 doesn't support the xtensa architecture, and as such I get these errors when trying to build with the esp32 toolchain:

 Compiling radium v0.7.0
error[E0432]: unresolved imports `core::sync::atomic::AtomicI64`, `core::sync::atomic::AtomicU64`
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/radium-0.7.0/src/lib.rs:53:34
   |
53 |         use core::sync::atomic::{AtomicI64, AtomicU64};
   |                                  ^^^^^^^^^  ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
   |                                  |
   |                                  no `AtomicI64` in `sync::atomic`
   |
help: a similar name exists in the module
   |
53 |         use core::sync::atomic::{AtomicI8, AtomicU64};
   |                                  ~~~~~~~~
help: a similar name exists in the module
   |
53 |         use core::sync::atomic::{AtomicI64, AtomicU8};
   |                                             ~~~~~~~~

error[E0412]: cannot find type `AtomicI64` in module `core::sync::atomic`
    --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/radium-0.7.0/src/types.rs:52:41
     |
52   |       if atomic(64) { core::sync::atomic::AtomicI64 }
     |                                           ^^^^^^^^^ help: a struct with a similar name exists: `AtomicI16`
     |
    ::: /home/runner/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2741:1
     |
2741 | / atomic_int! {
2742 | |     cfg(target_has_atomic = "16"),
2743 | |     cfg(target_has_atomic_equal_alignment = "16"),
2744 | |     stable(feature = "integer_atomics_stable", since = "1.34.0"),
...    |
2758 | |     i16 AtomicI16 ATOMIC_I16_INIT
2759 | | }
     | |_- similarly named struct `AtomicI16` defined here

error[E0412]: cannot find type `AtomicU64` in module `core::sync::atomic`
    --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/radium-0.7.0/src/types.rs:58:41
     |
58   |       if atomic(64) { core::sync::atomic::AtomicU64 }
     |                                           ^^^^^^^^^ help: a struct with a similar name exists: `AtomicU16`
     |
    ::: /home/runner/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2761:1
     |
2761 | / atomic_int! {
2762 | |     cfg(target_has_atomic = "16"),
2763 | |     cfg(target_has_atomic_equal_alignment = "16"),
2764 | |     stable(feature = "integer_atomics_stable", since = "1.34.0"),
...    |
2778 | |     u16 AtomicU16 ATOMIC_U16_INIT
2779 | | }
     | |_- similarly named struct `AtomicU16` defined here

Would it be possible to upgrade bitvec to radium 1.0.0? It would be less brittle as it relies on cfg(target_has_atomic). This would bump the MSRV of bitvec to 1.60.

Hello! Sorry to necro an old issue, but I'm running into a similar problem trying to use bitvec in my project. I'm using a rust/llvm fork to target the NEC v810 CPU, which has atomics but is only 32-bit. It looks like radium assumes that an unrecognized target supports AtomicU64, which I don't think is easy for me to add.

My target environment uses some memory-mapped structs with lots of bitfields, so I'm planning to try other libraries or maybe just plumb it together manually. But I'd love if I could use bitvec on embedded hardware from the 90s.

Would you like to publish bitvec 1.1.0 to solve this Issue? @myrrlyn