Add Bevy related test cases
This commit is contained in:
parent
287c77e921
commit
7079adb226
18
tests/ui/implied-bounds/auxiliary/bevy_ecs.rs
Normal file
18
tests/ui/implied-bounds/auxiliary/bevy_ecs.rs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// Related to Bevy regression #118553
|
||||||
|
|
||||||
|
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;
|
11
tests/ui/implied-bounds/bevy_world_query.rs
Normal file
11
tests/ui/implied-bounds/bevy_world_query.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// aux-crate:bevy_ecs=bevy_ecs.rs
|
||||||
|
// check-pass
|
||||||
|
// Related to Bevy regression #118553
|
||||||
|
|
||||||
|
extern crate bevy_ecs;
|
||||||
|
|
||||||
|
use bevy_ecs::*;
|
||||||
|
|
||||||
|
fn handler<'a>(_: ParamSet<Query<&'a u8>>) {}
|
||||||
|
|
||||||
|
fn main() {}
|
31
tests/ui/implied-bounds/gluon_salsa.rs
Normal file
31
tests/ui/implied-bounds/gluon_salsa.rs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// check-pass
|
||||||
|
// Related to Bevy regression #118553
|
||||||
|
|
||||||
|
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() {}
|
37
tests/ui/implied-bounds/sod_service_chain.rs
Normal file
37
tests/ui/implied-bounds/sod_service_chain.rs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// check-pass
|
||||||
|
// Related to crater regressions on #118553
|
||||||
|
|
||||||
|
pub trait Debug {}
|
||||||
|
|
||||||
|
pub trait Service {
|
||||||
|
type Input;
|
||||||
|
type Output;
|
||||||
|
type Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ServiceChain<P, S> {
|
||||||
|
prev: P,
|
||||||
|
service: S,
|
||||||
|
}
|
||||||
|
impl<P: Service, S: Service<Input = P::Output>> Service for ServiceChain<P, S>
|
||||||
|
where
|
||||||
|
P::Error: 'static,
|
||||||
|
S::Error: 'static,
|
||||||
|
{
|
||||||
|
type Input = P::Input;
|
||||||
|
type Output = S::Output;
|
||||||
|
type Error = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ServiceChainBuilder<P: Service, S: Service<Input = P::Output>> {
|
||||||
|
chain: ServiceChain<P, S>,
|
||||||
|
}
|
||||||
|
impl<P: Service, S: Service<Input = P::Output>> ServiceChainBuilder<P, S> {
|
||||||
|
pub fn next<NS: Service<Input = S::Output>>(
|
||||||
|
self,
|
||||||
|
) -> ServiceChainBuilder<ServiceChain<P, S>, NS> {
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user