1 // Regression test for #80953. Hitting the recursion limit in projection
2 // is non-fatal. The above code, minimised from wundergraph shows a case
3 // where this is relied on.
4
5 // check-pass
6
7 struct AlternateTable {}
8 struct AlternateQuery {}
9
10 pub trait Query {}
11 pub trait AsQuery {
12 type Query;
13 }
14 impl<T: Query> AsQuery for T {
15 type Query = Self;
16 }
17 impl AsQuery for AlternateTable {
18 type Query = AlternateQuery;
19 }
20
21 pub trait Table: AsQuery {
22 type PrimaryKey;
23 }
24 impl Table for AlternateTable {
25 type PrimaryKey = ();
26 }
27
28 pub trait FilterDsl<Predicate> {
29 type Output;
30 }
31 pub type Filter<Source, Predicate> = <Source as FilterDsl<Predicate>>::Output;
32 impl<T, Predicate> FilterDsl<Predicate> for T
33 where
34 T: Table,
35 T::Query: FilterDsl<Predicate>,
36 {
37 type Output = Filter<T::Query, Predicate>;
38 }
39 impl<Predicate> FilterDsl<Predicate> for AlternateQuery {
40 type Output = &'static str;
41 }
42
43 pub trait HandleDelete {
44 type Filter;
45 }
46 impl<T> HandleDelete for T
47 where
48 T: Table,
49 T::Query: FilterDsl<T::PrimaryKey>,
50 Filter<T::Query, T::PrimaryKey>: ,
51 {
52 type Filter = Filter<T::Query, T::PrimaryKey>;
53 }
54
main()55 fn main() {
56 let x: <AlternateTable as HandleDelete>::Filter = "Hello, world";
57 println!("{}", x);
58 }
59