Skip to content

Commit b846fe0

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

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Related to Bevy regression #118553
2+
3+
pub mod system {
4+
pub trait WorldQuery {}
5+
impl WorldQuery for &u8 {}
6+
7+
pub struct Query<Q: WorldQuery>(Q);
8+
9+
pub trait SystemParam {
10+
type State;
11+
}
12+
impl<Q: WorldQuery + 'static> SystemParam for Query<Q> {
13+
type State = ();
14+
// `Q: 'static` is required because we need the TypeId of Q ...
15+
}
16+
17+
pub struct ParamSet<T: SystemParam>(T)
18+
where
19+
T::State: Sized;
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
// For more information see #118553
7+
8+
extern crate bevy_ecs;
9+
10+
use bevy_ecs::system::*;
11+
12+
fn handler<'a>(_: ParamSet<Query<&'a u8>>) {}
13+
14+
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() {}
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)