Skip to content

Commit

Permalink
Add a missing impl of ReadOnlySystemParam for Option<NonSend<>> (b…
Browse files Browse the repository at this point in the history
…evyengine#7245)

# Objective

The trait `ReadOnlySystemParam` is not implemented for `Option<NonSend<>>`, even though it should be.

Follow-up to bevyengine#7243. This fixes another mistake made in bevyengine#6919.

## Solution

Add the missing impl.
  • Loading branch information
JoJoJet authored and alradish committed Jan 22, 2023
1 parent 532a050 commit 7c6c9ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,9 @@ unsafe impl<'a, T: 'static> SystemParam for NonSend<'a, T> {
}
}

// SAFETY: Only reads a single World non-send resource
unsafe impl<T: 'static> ReadOnlySystemParam for Option<NonSend<'_, T>> {}

// SAFETY: this impl defers to `NonSend`, which initializes and validates the correct world access.
unsafe impl<T: 'static> SystemParam for Option<NonSend<'_, T>> {
type State = ComponentId;
Expand Down

0 comments on commit 7c6c9ef

Please sign in to comment.