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

Unsound types: SharedMemoryReader & SharedMemoryManager #185

Closed
JEnoch opened this issue Jan 14, 2022 · 1 comment
Closed

Unsound types: SharedMemoryReader & SharedMemoryManager #185

JEnoch opened this issue Jan 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@JEnoch
Copy link
Member

JEnoch commented Jan 14, 2022

Starting from 1.58 Clippy reported this issue:

error: this implementation is unsound, as some fields in `SharedMemoryReader` are `!Send`
   --> zenoh/src/net/protocol/io/shm.rs:211:1
    |
211 | unsafe impl Send for SharedMemoryReader {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
note: the type of field `segments` is `!Send`
   --> zenoh/src/net/protocol/io/shm.rs:208:5
    |
208 |     segments: HashMap<String, Shmem>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: use a thread-safe type that implements `Send`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_send_fields_in_send_ty
error: this implementation is unsound, as some fields in `SharedMemoryManager` are `!Send`
   --> zenoh/src/net/protocol/io/shm.rs:300:1
    |
300 | unsafe impl Send for SharedMemoryManager {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: the type of field `own_segment` is `!Send`
   --> zenoh/src/net/protocol/io/shm.rs:294:5
    |
294 |     own_segment: Shmem,
    |     ^^^^^^^^^^^^^^^^^^
    = help: use a thread-safe type that implements `Send`
note: the type of field `free_list` is `!Send`
   --> zenoh/src/net/protocol/io/shm.rs:295:5
    |
295 |     free_list: BinaryHeap<Chunk>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: use a thread-safe type that implements `Send`
note: the type of field `busy_list` is `!Send`
   --> zenoh/src/net/protocol/io/shm.rs:296:5
    |
296 |     busy_list: Vec<Chunk>,
    |     ^^^^^^^^^^^^^^^^^^^^^
    = help: use a thread-safe type that implements `Send`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_send_fields_in_send_ty
error: could not compile `zenoh` due to 2 previous errors

The current workaround is to allow this warning.
But we need a more definitive solution.

@Mallets
Copy link
Member

Mallets commented Feb 15, 2022

The default behaviour in clippy has been reverted because of high number of false positive: rust-lang/rust-clippy#8045.

Need to check if the workaround is still needed or it can be removed.

@Mallets Mallets added the bug Something isn't working label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants