Skip to content

Failure to compile with latest embassy-sync #361

@wmmc88

Description

@wmmc88

After embassy-rs/embassy#4320 merged, several bugs in ODP were exposed around improper Sync bounds. One of the major errors is IntrusiveList being used everywhere in OnceLock's when IntrusiveList is !Sync

error[E0277]: `core::cell::Cell<core::option::Option<&'static intrusive_list::IntrusiveNode>>` cannot be shared between threads safely         
   --> D:\.tools\.cargo\git\checkouts\embedded-services-78faf442f1f643c2\a938ac1\embedded-service\src\activity.rs:135:21
    |
135 | static SUBSCRIBERS: OnceLock<IntrusiveList> = OnceLock::new();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^ `core::cell::Cell<core::option::Option<&'static intrusive_list::IntrusiveNode>>` cannot be shared between threads safely
    |
    = help: within `intrusive_list::IntrusiveList`, the trait `Sync` is not implemented for `core::cell::Cell<core::option::Option<&'static intrusive_list::IntrusiveNode>>`
    = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
note: required because it appears within the type `intrusive_list::IntrusiveList`
   --> D:\.tools\.cargo\git\checkouts\embedded-services-78faf442f1f643c2\a938ac1\embedded-service\src\intrusive_list.rs:62:12
    |
62  | pub struct IntrusiveList {
    |            ^^^^^^^^^^^^^
    = note: required for `OnceLock<intrusive_list::IntrusiveList>` to implement `Sync`
    = note: shared static variables must have a type that implements `Sync`

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions