Skip to content

RP2040 missing atomic #93

Description

@Erhannis

I'm compiling for an RP2040 and getting a bunch of compile errors I assume are because either I'm missing a library or something's incompatible with atomics somehow.

error[E0599]: no method named `compare_exchange` found for struct `AtomicBool` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/mpsc/async_impl.rs:974:18
    |
973 | /             self.is_split
974 | |                 .compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
    | |                 -^^^^^^^^^^^^^^^^ method not found in `AtomicBool`
    | |_________________|
    |

error[E0599]: no method named `fetch_add` found for struct `AtomicUsize` in the current scope
    --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/mpsc/async_impl.rs:1304:42
     |
1304 |             test_dbg!(self.core.tx_count.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
    --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/mpsc/async_impl.rs:1315:45
     |
1315 |             if test_dbg!(self.core.tx_count.fetch_sub(1, Ordering::Release)) > 1 {
     |                                             ^^^^^^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `compare_exchange` found for struct `AtomicBool` in the current scope
  --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util/mutex/spin_impl.rs:43:37
   |
43 |         while test_dbg!(self.locked.compare_exchange(false, true, AcqRel, Acquire)).is_err() {
   |                                     ^^^^^^^^^^^^^^^^ method not found in `AtomicBool`

error[E0599]: no method named `compare_exchange` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/cell.rs:188:14
    |
187 | /         self.lock
188 | |             .compare_exchange(curr, new, success, Acquire)
    | |             -^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    | |_____________|
    |
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  |   pub(crate) struct CachePadded<T>(pub(crate) T);
    |   -------------------------------- method `compare_exchange` not found for this struct

error[E0599]: no method named `fetch_and` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/cell.rs:195:25
    |
195 |         State(self.lock.fetch_and(state, order))
    |                         ^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `fetch_and` not found for this struct

error[E0599]: no method named `fetch_or` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/cell.rs:200:25
    |
200 |         State(self.lock.fetch_or(state, order))
    |                         ^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `fetch_or` not found for this struct

error[E0599]: no method named `compare_exchange` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:193:36
    |
193 |         match test_dbg!(self.state.compare_exchange(WAKING, EMPTY, SeqCst, SeqCst)) {
    |                                    ^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `compare_exchange` not found for this struct

error[E0599]: no method named `compare_exchange_weak` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:227:26
    |
225 |                       match test_dbg!(self
    |  _____________________________________-
226 | |                         .state
227 | |                         .compare_exchange_weak(EMPTY, WAITING, SeqCst, SeqCst))
    | |                         -^^^^^^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    | |_________________________|
    |
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  |   pub(crate) struct CachePadded<T>(pub(crate) T);
    |   -------------------------------- method `compare_exchange_weak` not found for this struct

error[E0599]: no method named `compare_exchange_weak` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:242:26
    |
240 |                       match test_dbg!(self
    |  _____________________________________-
241 | |                         .state
242 | |                         .compare_exchange_weak(WAKING, EMPTY, SeqCst, SeqCst))
    | |                         -^^^^^^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    | |_________________________|
    |
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  |   pub(crate) struct CachePadded<T>(pub(crate) T);
    |   -------------------------------- method `compare_exchange_weak` not found for this struct

error[E0599]: no method named `swap` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:280:48
    |
280 |         let _prev_state = test_dbg!(node.state.swap(WAITING, Release));
    |                                                ^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `swap` not found for this struct

error[E0599]: no method named `compare_exchange_weak` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:380:18
    |
378 |               match test_dbg!(self
    |  _____________________________-
379 | |                 .state
380 | |                 .compare_exchange_weak(state, WAKING, SeqCst, SeqCst))
    | |                 -^^^^^^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    | |_________________|
    |
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  |   pub(crate) struct CachePadded<T>(pub(crate) T);
    |   -------------------------------- method `compare_exchange_weak` not found for this struct

error[E0599]: no method named `compare_exchange` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:404:49
    |
404 |                 if let Err(actual) = self.state.compare_exchange(state, WAKING, SeqCst, SeqCst) {
    |                                                 ^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `compare_exchange` not found for this struct

error[E0599]: no method named `swap` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:446:30
    |
446 |         test_dbg!(self.state.swap(CLOSED, SeqCst));
    |                              ^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `swap` not found for this struct

error[E0599]: no method named `compare_exchange` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:484:39
    |
484 |             let _ = test_dbg!(q.state.compare_exchange(WAITING, EMPTY, SeqCst, SeqCst));
    |                                       ^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `compare_exchange` not found for this struct

error[E0599]: no method named `swap` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/wait/queue.rs:581:48
    |
581 |         let _prev_state = test_dbg!(last.state.swap(new_state, Release));
    |                                                ^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `swap` not found for this struct

error[E0599]: no method named `fetch_or` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:189:29
    |
189 |         test_dbg!(self.tail.fetch_or(self.closed, SeqCst) & self.closed == 0)
    |                             ^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `fetch_or` not found for this struct

error[E0599]: no method named `compare_exchange_weak` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:236:22
    |
234 |                   match test_dbg!(self
    |  _________________________________-
235 | |                     .tail
236 | |                     .compare_exchange_weak(tail, next_tail, SeqCst, Acquire))
    | |                     -^^^^^^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    | |_____________________|
    |
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  |   pub(crate) struct CachePadded<T>(pub(crate) T);
    |   -------------------------------- method `compare_exchange_weak` not found for this struct

error[E0599]: no method named `fetch_update` found for struct `AtomicUsize` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:248:30
    |
246 |                           test_dbg!(slot
    |  ___________________________________-
247 | |                             .state
248 | |                             .fetch_update(SeqCst, SeqCst, |state| {
    | |                             -^^^^^^^^^^^^ method not found in `AtomicUsize`
    | |_____________________________|
    |

error[E0599]: no method named `fetch_or` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:307:44
    |
307 |             let head = test_dbg!(self.head.fetch_or(0, SeqCst));
    |                                            ^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `fetch_or` not found for this struct

   Compiling rtic-sync v1.3.0
error[E0599]: no method named `compare_exchange_weak` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:365:22
    |
363 |                   match test_dbg!(self
    |  _________________________________-
364 | |                     .head
365 | |                     .compare_exchange_weak(head, next_head, SeqCst, Acquire))
    | |                     -^^^^^^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    | |_____________________|
    |
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  |   pub(crate) struct CachePadded<T>(pub(crate) T);
    |   -------------------------------- method `compare_exchange_weak` not found for this struct

error[E0599]: no method named `fetch_or` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:396:48
    |
396 |                 let tail = test_dbg!(self.tail.fetch_or(0, SeqCst));
    |                                                ^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `fetch_or` not found for this struct

error[E0599]: no method named `compare_exchange` found for struct `CachePadded<AtomicUsize>` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:416:43
    |
416 |                 match test_dbg!(self.head.compare_exchange(head, next_head, SeqCst, Acquire)) {
    |                                           ^^^^^^^^^^^^^^^^ method not found in `CachePadded<AtomicUsize>`
    |
   ::: /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/util.rs:19:1
    |
19  | pub(crate) struct CachePadded<T>(pub(crate) T);
    | -------------------------------- method `compare_exchange` not found for this struct

warning: the `-Cinline-threshold` flag is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)

error[E0599]: no method named `fetch_and` found for struct `AtomicUsize` in the current scope
   --> /home/erhannis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thingbuf-0.1.6/src/lib.rs:570:39
    |
570 |             test_dbg!(self.slot.state.fetch_and(!HAS_READER, SeqCst));
    |                                       ^^^^^^^^^ method not found in `AtomicUsize`

   Compiling rtic-monotonics v2.0.3
warning: the `-Cinline-threshold` flag is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)

For more information about this error, try `rustc --explain E0599`.
error: could not compile `thingbuf` (lib) due to 24 previous errors
warning: build failed, waiting for other jobs to finish...

I didn't see anything in the docs about extra libraries I should import, so here I am.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions