Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use atomic-polyfill for AtomicCheckMutex #30

Merged
merged 1 commit into from
Feb 9, 2022
Merged

Use atomic-polyfill for AtomicCheckMutex #30

merged 1 commit into from
Feb 9, 2022

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
2 participants