-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
287c77e
commit adea760
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
pub mod system { | ||
pub trait WorldQuery {} | ||
impl WorldQuery for &u8 {} | ||
|
||
pub struct Query<Q: WorldQuery>(Q); | ||
|
||
pub trait SystemParam { | ||
type State; | ||
} | ||
impl<Q: WorldQuery + 'static> SystemParam for Query<Q> { | ||
type State = (); | ||
// `Q: 'static` is required because we need the TypeId of Q ... | ||
} | ||
|
||
pub struct ParamSet<T: SystemParam>(T) where T::State: Sized; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// aux-crate:bevy_ecs=bevy_ecs.rs | ||
// check-pass | ||
|
||
// We currently special case bevy from emitting the `IMPLIED_BOUNDS_FROM_TRAIT_IMPL` lint. | ||
// Otherwise, we would expect this to hit the lint. | ||
|
||
extern crate bevy_ecs; | ||
|
||
use bevy_ecs::system::*; | ||
|
||
fn handler<'a>(_: ParamSet<Query<&'a u8>>) {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// check-pass | ||
|
||
pub trait QueryBase { | ||
type Db; | ||
} | ||
|
||
pub trait AsyncQueryFunction<'f>: // 'f is important | ||
QueryBase<Db = <Self as AsyncQueryFunction<'f>>::SendDb> // bound is important | ||
{ | ||
type SendDb; | ||
} | ||
|
||
pub struct QueryTable<'me, Q, DB> { | ||
_q: Option<Q>, | ||
_db: Option<DB>, | ||
_marker: Option<&'me ()>, | ||
} | ||
|
||
impl<'me, Q> QueryTable<'me, Q, <Q as QueryBase>::Db> // projection is important | ||
// ^^^ removing 'me (and in QueryTable) gives a different error | ||
where | ||
Q: for<'f> AsyncQueryFunction<'f>, | ||
{ | ||
pub fn get_async<'a>(&'a mut self) { | ||
panic!(); | ||
} | ||
} | ||
|
||
fn main() {} |