Skip to content

new clippy lint: unsound Send implementations #3666

@mockersf

Description

@mockersf

Bevy version

7fd781e

What you did

Running clippy with rust 1.58

What you expected to happen

No issues

What actually happened

Two failures:

error: this implementation is unsound, as some fields in `World` are `!Send`
    --> crates/bevy_ecs/src/world/mod.rs:1163:1
     |
1163 | unsafe impl Send for World {}
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
note: the type of field `archetypes` is `!Send`
    --> crates/bevy_ecs/src/world/mod.rs:75:5
     |
75   |     pub(crate) archetypes: Archetypes,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = help: use a thread-safe type that implements `Send`
note: the type of field `storages` is `!Send`
    --> crates/bevy_ecs/src/world/mod.rs:76:5
     |
76   |     pub(crate) storages: Storages,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = 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 `bevy_ecs` due to previous error
error: this implementation is unsound, as some fields in `FlexSurface` are `!Send`
  --> crates/bevy_ui/src/flex/mod.rs:26:1
   |
26 | unsafe impl Send for FlexSurface {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
note: the type of field `stretch` is `!Send`
  --> crates/bevy_ui/src/flex/mod.rs:21:5
   |
21 |     stretch: Stretch,
   |     ^^^^^^^^^^^^^^^^
   = 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 `bevy_ui` due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsA-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions