@@ -646,12 +646,12 @@ impl<'w, 's> SystemParamFetch<'w, 's> for WorldState {
646
646
/// // .add_system(reset_to_system(my_config))
647
647
/// # assert_is_system(reset_to_system(Config(10)));
648
648
/// ```
649
- pub struct Local < ' a , T : Resource > ( & ' a mut T ) ;
649
+ pub struct Local < ' a , T : Send + Sync + ' static > ( & ' a mut T ) ;
650
650
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 > { }
653
653
654
- impl < ' a , T : Resource > Debug for Local < ' a , T >
654
+ impl < ' a , T : Send + Sync + ' static > Debug for Local < ' a , T >
655
655
where
656
656
T : Debug ,
657
657
{
@@ -660,7 +660,7 @@ where
660
660
}
661
661
}
662
662
663
- impl < ' a , T : Resource > Deref for Local < ' a , T > {
663
+ impl < ' a , T : Send + Sync + ' static > Deref for Local < ' a , T > {
664
664
type Target = T ;
665
665
666
666
#[ inline]
@@ -669,7 +669,7 @@ impl<'a, T: Resource> Deref for Local<'a, T> {
669
669
}
670
670
}
671
671
672
- impl < ' a , T : Resource > DerefMut for Local < ' a , T > {
672
+ impl < ' a , T : Send + Sync + ' static > DerefMut for Local < ' a , T > {
673
673
#[ inline]
674
674
fn deref_mut ( & mut self ) -> & mut Self :: Target {
675
675
self . 0
@@ -678,20 +678,20 @@ impl<'a, T: Resource> DerefMut for Local<'a, T> {
678
678
679
679
/// The [`SystemParamState`] of [`Local<T>`].
680
680
#[ doc( hidden) ]
681
- pub struct LocalState < T : Resource > ( T ) ;
681
+ pub struct LocalState < T : Send + Sync + ' static > ( T ) ;
682
682
683
- impl < ' a , T : Resource + FromWorld > SystemParam for Local < ' a , T > {
683
+ impl < ' a , T : Send + Sync + ' static + FromWorld > SystemParam for Local < ' a , T > {
684
684
type Fetch = LocalState < T > ;
685
685
}
686
686
687
687
// 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 > {
689
689
fn init ( world : & mut World , _system_meta : & mut SystemMeta ) -> Self {
690
690
Self ( T :: from_world ( world) )
691
691
}
692
692
}
693
693
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 > {
695
695
type Item = Local < ' s , T > ;
696
696
697
697
#[ inline]
0 commit comments