Skip to content

Commit adea760

Browse files
committed
Add Bevy related test cases
1 parent 287c77e commit adea760

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pub mod system {
2+
pub trait WorldQuery {}
3+
impl WorldQuery for &u8 {}
4+
5+
pub struct Query<Q: WorldQuery>(Q);
6+
7+
pub trait SystemParam {
8+
type State;
9+
}
10+
impl<Q: WorldQuery + 'static> SystemParam for Query<Q> {
11+
type State = ();
12+
// `Q: 'static` is required because we need the TypeId of Q ...
13+
}
14+
15+
pub struct ParamSet<T: SystemParam>(T) where T::State: Sized;
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// aux-crate:bevy_ecs=bevy_ecs.rs
2+
// check-pass
3+
4+
// We currently special case bevy from emitting the `IMPLIED_BOUNDS_FROM_TRAIT_IMPL` lint.
5+
// Otherwise, we would expect this to hit the lint.
6+
7+
extern crate bevy_ecs;
8+
9+
use bevy_ecs::system::*;
10+
11+
fn handler<'a>(_: ParamSet<Query<&'a u8>>) {}
12+
13+
fn main() {}
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// check-pass
2+
3+
pub trait QueryBase {
4+
type Db;
5+
}
6+
7+
pub trait AsyncQueryFunction<'f>: // 'f is important
8+
QueryBase<Db = <Self as AsyncQueryFunction<'f>>::SendDb> // bound is important
9+
{
10+
type SendDb;
11+
}
12+
13+
pub struct QueryTable<'me, Q, DB> {
14+
_q: Option<Q>,
15+
_db: Option<DB>,
16+
_marker: Option<&'me ()>,
17+
}
18+
19+
impl<'me, Q> QueryTable<'me, Q, <Q as QueryBase>::Db> // projection is important
20+
// ^^^ removing 'me (and in QueryTable) gives a different error
21+
where
22+
Q: for<'f> AsyncQueryFunction<'f>,
23+
{
24+
pub fn get_async<'a>(&'a mut self) {
25+
panic!();
26+
}
27+
}
28+
29+
fn main() {}

0 commit comments

Comments
 (0)