Skip to content

Commit d021a3c

Browse files
authored
Relaxed bounds on NonSend. (#1448)
1 parent f8292cc commit d021a3c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/bevy_ecs/src/resource/resource_query.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ impl<'a, T: Resource + FromResources> DerefMut for Local<'a, T> {
136136
/// `NonSend<T>` resources cannot leave the main thread, so any system that wants access to
137137
/// a non-send resource will run on the main thread. See `Resources::insert_non_send()` and friends.
138138
#[derive(Debug)]
139-
pub struct NonSend<'a, T: Resource> {
139+
pub struct NonSend<'a, T: 'static> {
140140
value: *mut T,
141141
_marker: PhantomData<&'a T>,
142142
}
143143

144-
impl<'a, T: Resource> NonSend<'a, T> {
144+
impl<'a, T: 'static> NonSend<'a, T> {
145145
pub(crate) unsafe fn new(resources: &Resources) -> Self {
146146
NonSend {
147147
value: resources.get_unsafe_non_send_ref::<T>().as_ptr(),
@@ -150,15 +150,15 @@ impl<'a, T: Resource> NonSend<'a, T> {
150150
}
151151
}
152152

153-
impl<'a, T: Resource> Deref for NonSend<'a, T> {
153+
impl<'a, T: 'static> Deref for NonSend<'a, T> {
154154
type Target = T;
155155

156156
fn deref(&self) -> &T {
157157
unsafe { &*self.value }
158158
}
159159
}
160160

161-
impl<'a, T: Resource> DerefMut for NonSend<'a, T> {
161+
impl<'a, T: 'static> DerefMut for NonSend<'a, T> {
162162
fn deref_mut(&mut self) -> &mut T {
163163
unsafe { &mut *self.value }
164164
}

0 commit comments

Comments
 (0)