@@ -646,12 +646,12 @@ impl<'w, 's> SystemParamFetch<'w, 's> for WorldState {
646646/// // .add_system(reset_to_system(my_config))
647647/// # assert_is_system(reset_to_system(Config(10)));
648648/// ```
649- pub struct Local < ' a , T : Resource > ( & ' a mut T ) ;
649+ pub struct Local < ' a , T : Send + Sync + ' static > ( & ' a mut T ) ;
650650
651- // SAFE: Local only accesses internal state
652- unsafe impl < T : Resource > ReadOnlySystemParamFetch for LocalState < T > { }
651+ // SAFE: Local only accesses internal state, and a system cannot be run twice simultaneously
652+ unsafe impl < T : Send + Sync + ' static > ReadOnlySystemParamFetch for LocalState < T > { }
653653
654- impl < ' a , T : Resource > Debug for Local < ' a , T >
654+ impl < ' a , T : : Send + Sync + ' static > Debug for Local < ' a , T >
655655where
656656 T : Debug ,
657657{
@@ -660,7 +660,7 @@ where
660660 }
661661}
662662
663- impl < ' a , T : Resource > Deref for Local < ' a , T > {
663+ impl < ' a , T : Send + Sync + ' static > Deref for Local < ' a , T > {
664664 type Target = T ;
665665
666666 #[ inline]
@@ -669,7 +669,7 @@ impl<'a, T: Resource> Deref for Local<'a, T> {
669669 }
670670}
671671
672- impl < ' a , T : Resource > DerefMut for Local < ' a , T > {
672+ impl < ' a , T : Send + Sync + ' static > DerefMut for Local < ' a , T > {
673673 #[ inline]
674674 fn deref_mut ( & mut self ) -> & mut Self :: Target {
675675 self . 0
@@ -678,20 +678,20 @@ impl<'a, T: Resource> DerefMut for Local<'a, T> {
678678
679679/// The [`SystemParamState`] of [`Local<T>`].
680680#[ doc( hidden) ]
681- pub struct LocalState < T : Resource > ( T ) ;
681+ pub struct LocalState < T : Send + Sync + ' static > ( T ) ;
682682
683- impl < ' a , T : Resource + FromWorld > SystemParam for Local < ' a , T > {
683+ impl < ' a , T : Send + Sync + ' static + FromWorld > SystemParam for Local < ' a , T > {
684684 type Fetch = LocalState < T > ;
685685}
686686
687687// SAFE: only local state is accessed
688- unsafe impl < T : Resource + FromWorld > SystemParamState for LocalState < T > {
688+ unsafe impl < T : Send + Sync + ' static + FromWorld > SystemParamState for LocalState < T > {
689689 fn init ( world : & mut World , _system_meta : & mut SystemMeta ) -> Self {
690690 Self ( T :: from_world ( world) )
691691 }
692692}
693693
694- impl < ' w , ' s , T : Resource + FromWorld > SystemParamFetch < ' w , ' s > for LocalState < T > {
694+ impl < ' w , ' s , T : Send + Sync + ' static + FromWorld > SystemParamFetch < ' w , ' s > for LocalState < T > {
695695 type Item = Local < ' s , T > ;
696696
697697 #[ inline]
0 commit comments