Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Rahix
Copy link
Owner

@Rahix Rahix commented Feb 7, 2022

This will allow using shared-bus on thumbv6 platforms which do not have real atomics.

@pdgilbert, can you please give this a try on your systems to verify that it actually works now?

Fixes #29.

@pdgilbert
Copy link

Maybe you left in some debugging statements? I'm getting

   Compiling shared-bus v0.2.2 (https://github.com/Rahix/shared-bus?branch=atomic-polyfill#1474747c)
error[E0308]: mismatched types
   --> /home/paul/.cargo/git/checkouts/shared-bus-afeeec54cdff0f33/1474747/src/mutex.rs:202:53
    |
202 |             busy: atomic_polyfill::AtomicBool::from(false),
    |                                                     ^^^^^ expected struct `atomic_polyfill::AtomicBool`, found `bool`

error[E0277]: `atomic_polyfill::AtomicBool` doesn't implement `Debug`
   --> /home/paul/.cargo/git/checkouts/shared-bus-afeeec54cdff0f33/1474747/src/mutex.rs:187:5
    |
184 | #[derive(Debug)]
    |          ----- in this derive macro expansion
...
187 |     busy: atomic_polyfill::AtomicBool,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `atomic_polyfill::AtomicBool` cannot be formatted using `{:?}` because it doesn't implement `Debug`
    |
    = help: the trait `Debug` is not implemented for `atomic_polyfill::AtomicBool`
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

@Rahix
Copy link
Owner Author

Rahix commented Feb 8, 2022

error[E0308]: mismatched types
   --> /home/paul/.cargo/git/checkouts/shared-bus-afeeec54cdff0f33/1474747/src/mutex.rs:202:53
    |
202 |             busy: atomic_polyfill::AtomicBool::from(false),
    |                                                     ^^^^^ expected struct `atomic_polyfill::AtomicBool`, found `bool`

Okay, it looks like there is a

impl From<bool> for atomic_polyfill::AtomicBool { }

missing in atomic-polyfill.

error[E0277]: `atomic_polyfill::AtomicBool` doesn't implement `Debug`
   --> /home/paul/.cargo/git/checkouts/shared-bus-afeeec54cdff0f33/1474747/src/mutex.rs:187:5
    |
184 | #[derive(Debug)]
    |          ----- in this derive macro expansion
...
187 |     busy: atomic_polyfill::AtomicBool,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `atomic_polyfill::AtomicBool` cannot be formatted using `{:?}` because it doesn't implement `Debug`

And this seems to be a known issue: embassy-rs/atomic-polyfill#11

I think the most reasonable solution here is to send a PR upstream to fix these two. I'll try to do that in the coming days and I will ping you once this PR here is ready for re-testing.

@pdgilbert
Copy link

Sounds good.

This will allow using shared-bus on thumbv6 platforms which do not have
real atomics.
@Rahix
Copy link
Owner Author

Rahix commented Feb 8, 2022

@pdgilbert, here you go, atomic-polyfill already released a new version with the fixes. Please try again :)

@pdgilbert
Copy link

Looks good. Thanks @Rahix .

@Rahix Rahix merged commit 4b66f0a into main Feb 9, 2022
@Rahix Rahix deleted the atomic-polyfill branch February 9, 2022 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

method not found in AtomicBool

3 participants