From b5893e570d2a68471d2f3d147751dcc33bac32e0 Mon Sep 17 00:00:00 2001 From: JoJoJet <21144246+JoJoJet@users.noreply.github.com> Date: Tue, 17 Jan 2023 03:29:08 +0000 Subject: [PATCH] Add a missing impl of `ReadOnlySystemParam` for `Option>` (#7245) # Objective The trait `ReadOnlySystemParam` is not implemented for `Option>`, even though it should be. Follow-up to #7243. This fixes another mistake made in #6919. ## Solution Add the missing impl. --- crates/bevy_ecs/src/system/system_param.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 921bba36b2710..9cb7fb3dfc8b2 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -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 ReadOnlySystemParam for Option> {} + // SAFETY: this impl defers to `NonSend`, which initializes and validates the correct world access. unsafe impl SystemParam for Option> { type State = ComponentId;