Skip to content

take care of clippy::non_send_fields_in_send_ty #142

@ChunMinChang

Description

@ChunMinChang

We have two clippy::non_send_fields_in_send_ty warnings that should be take care of carefully.

unsafe impl Send for AudioUnitContext {}

warning: this implementation is unsound, as some fields in `AudioUnitContext` are `!Send`
    --> src/backend/mod.rs:2263:1
     |
2263 | unsafe impl Send for AudioUnitContext {}
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `#[warn(clippy::non_send_fields_in_send_ty)]` on by default
note: the type of field `serial_queue` is `!Send`
    --> src/backend/mod.rs:1882:5
     |
1882 |     serial_queue: Queue,
     |     ^^^^^^^^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `devices` is `!Send`
    --> src/backend/mod.rs:1884:5
     |
1884 |     devices: Mutex<SharedDevices>,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = 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

unsafe impl<'ctx> Send for AudioUnitStream<'ctx> {}

warning: this implementation is unsound, as some fields in `AudioUnitStream<'ctx>` are `!Send`
    --> src/backend/mod.rs:3632:1
     |
3632 | unsafe impl<'ctx> Send for AudioUnitStream<'ctx> {}
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
note: the type of field `queue` is `!Send`
    --> src/backend/mod.rs:3135:5
     |
3135 |     queue: Queue,
     |     ^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `core_stream_data` is `!Send`
    --> src/backend/mod.rs:3164:5
     |
3164 |     core_stream_data: CoreStreamData<'ctx>,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = 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

See more here: https://rust-lang.github.io/rust-clippy/master/#non_send_fields_in_send_ty

I temporarily allow this for now since I cannot find serious bugs related to this. But it's better to take care of the threading issue more carefully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions