]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/issue-68264-overflow.rs
Sync rustc_codegen_cranelift 'ddd4ce25535cf71203ba3700896131ce55fde795'
[rust.git] / src / test / ui / consts / issue-68264-overflow.rs
1 // check-pass
2 // compile-flags: --emit=mir,link
3 // Regression test for issue #68264
4 // Checks that we don't encounter overflow
5 // when running const-prop on functions with
6 // complicated bounds
7 pub trait Query {}
8
9 pub trait AsQuery {
10     type Query: Query;
11 }
12 pub trait Table: AsQuery + Sized {}
13
14 pub trait LimitDsl {
15     type Output;
16 }
17
18 pub(crate) trait LoadQuery<Conn, U>: RunQueryDsl<Conn> {}
19
20 impl<T: Query> AsQuery for T {
21     type Query = Self;
22 }
23
24 impl<T> LimitDsl for T
25 where
26     T: Table,
27     T::Query: LimitDsl,
28 {
29     type Output = <T::Query as LimitDsl>::Output;
30 }
31
32 pub(crate) trait RunQueryDsl<Conn>: Sized {
33     fn first<U>(self, _conn: &Conn) -> U
34     where
35         Self: LimitDsl,
36         Self::Output: LoadQuery<Conn, U>,
37     {
38         // Overflow is caused by this function body
39         unimplemented!()
40     }
41 }
42
43 fn main() {}