Skip to content

Commit 7079adb

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

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Related to Bevy regression #118553
2+
3+
pub trait WorldQuery {}
4+
impl WorldQuery for &u8 {}
5+
6+
pub struct Query<Q: WorldQuery>(Q);
7+
8+
pub trait SystemParam {
9+
type State;
10+
}
11+
impl<Q: WorldQuery + 'static> SystemParam for Query<Q> {
12+
type State = ();
13+
// `Q: 'static` is required because we need the TypeId of Q ...
14+
}
15+
16+
pub struct ParamSet<T: SystemParam>(T)
17+
where
18+
T::State: Sized;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// aux-crate:bevy_ecs=bevy_ecs.rs
2+
// check-pass
3+
// Related to Bevy regression #118553
4+
5+
extern crate bevy_ecs;
6+
7+
use bevy_ecs::*;
8+
9+
fn handler<'a>(_: ParamSet<Query<&'a u8>>) {}
10+
11+
fn main() {}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// check-pass
2+
// Related to Bevy regression #118553
3+
4+
pub trait QueryBase {
5+
type Db;
6+
}
7+
8+
pub trait AsyncQueryFunction<'f>: // 'f is important
9+
QueryBase<Db = <Self as AsyncQueryFunction<'f>>::SendDb> // bound is important
10+
{
11+
type SendDb;
12+
}
13+
14+
pub struct QueryTable<'me, Q, DB> {
15+
_q: Option<Q>,
16+
_db: Option<DB>,
17+
_marker: Option<&'me ()>,
18+
}
19+
20+
impl<'me, Q> QueryTable<'me, Q, <Q as QueryBase>::Db>
21+
// projection is important
22+
// ^^^ removing 'me (and in QueryTable) gives a different error
23+
where
24+
Q: for<'f> AsyncQueryFunction<'f>,
25+
{
26+
pub fn get_async<'a>(&'a mut self) {
27+
panic!();
28+
}
29+
}
30+
31+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// check-pass
2+
// Related to crater regressions on #118553
3+
4+
pub trait Debug {}
5+
6+
pub trait Service {
7+
type Input;
8+
type Output;
9+
type Error;
10+
}
11+
12+
pub struct ServiceChain<P, S> {
13+
prev: P,
14+
service: S,
15+
}
16+
impl<P: Service, S: Service<Input = P::Output>> Service for ServiceChain<P, S>
17+
where
18+
P::Error: 'static,
19+
S::Error: 'static,
20+
{
21+
type Input = P::Input;
22+
type Output = S::Output;
23+
type Error = ();
24+
}
25+
26+
pub struct ServiceChainBuilder<P: Service, S: Service<Input = P::Output>> {
27+
chain: ServiceChain<P, S>,
28+
}
29+
impl<P: Service, S: Service<Input = P::Output>> ServiceChainBuilder<P, S> {
30+
pub fn next<NS: Service<Input = S::Output>>(
31+
self,
32+
) -> ServiceChainBuilder<ServiceChain<P, S>, NS> {
33+
panic!();
34+
}
35+
}
36+
37+
fn main() {}

0 commit comments

Comments
 (0)