]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/issue-92111.rs
Rollup merge of #93813 - xldenis:public-mir-passes, r=wesleywiser
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / issue-92111.rs
1 // Regression test for #92111.
2 //
3 // The issue was that we normalize trait bounds before caching
4 // results of selection. Checking that `impl Tr for S` requires
5 // checking `S: !Drop` because it cannot overlap with the blanket
6 // impl. Then we save the (unsatisfied) result from checking `S: Drop`.
7 // Then the call to `a` checks whether `S: ~const Drop` but we normalize
8 // it to `S: Drop` which the cache claims to be unsatisfied.
9 //
10 // check-pass
11
12 #![feature(const_trait_impl)]
13 #![feature(const_fn_trait_bound)]
14
15 pub trait Tr {}
16
17 #[allow(drop_bounds)]
18 impl<T: Drop> Tr for T {}
19
20 #[derive(Debug)]
21 pub struct S(i32);
22
23 impl Tr for S {}
24
25 const fn a<T: ~const Drop>(t: T) {}
26
27 fn main() {
28     a(S(0));
29 }