Skip to content

gtk: Clippy warns about unsound Send implementation #2067

@jplatte

Description

@jplatte

Nightly clippy raises the following warning:

warning: this implementation is unsound, as some fields in `WindowState` are `!Send`
    --> druid-shell/src/backend/gtk/window.rs:1271:1
     |
1271 | unsafe impl Send for WindowState {}
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `#[warn(clippy::non_send_fields_in_send_ty)]` on by default
note: the type of field `window` is `!Send`
    --> druid-shell/src/backend/gtk/window.rs:173:5
     |
173  |     window: ApplicationWindow,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `drawing_area` is `!Send`
    --> druid-shell/src/backend/gtk/window.rs:180:5
     |
180  |     drawing_area: DrawingArea,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `surface` is `!Send`
    --> druid-shell/src/backend/gtk/window.rs:191:5
     |
191  |     surface: RefCell<Option<Surface>>,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `handler` is `!Send`
    --> druid-shell/src/backend/gtk/window.rs:196:5
     |
196  |     pub(crate) handler: RefCell<Box<dyn WinHandler>>,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `deferred_queue` is `!Send`
    --> druid-shell/src/backend/gtk/window.rs:201:5
     |
201  |     deferred_queue: RefCell<Vec<DeferredOp>>,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `parent` is `!Send`
    --> druid-shell/src/backend/gtk/window.rs:206:5
     |
206  |     parent: Option<crate::WindowHandle>,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    shell/gtkconcerns the GTK backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions