]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/conservative_is_privately_uninhabited_uses_correct_param_env-1.rs
Override rustc version in ui and mir-opt tests to get stable hashes
[rust.git] / src / test / ui / const-generics / conservative_is_privately_uninhabited_uses_correct_param_env-1.rs
1 // run-pass
2 #![feature(generic_const_exprs)]
3 #![allow(incomplete_features)]
4
5 // This tests that the `conservative_is_privately_uninhabited` fn doesn't cause
6 // ICEs by trying to evaluate `T::ASSOC` with an incorrect `ParamEnv`.
7
8 trait Foo {
9     const ASSOC: usize = 1;
10 }
11
12 struct Iced<T: Foo>(T, [(); T::ASSOC])
13 where
14     [(); T::ASSOC]: ;
15
16 impl Foo for u32 {}
17
18 fn foo<T: Foo>()
19 where
20     [(); T::ASSOC]: ,
21 {
22     let _iced: Iced<T> = return;
23 }
24
25 fn main() {
26     foo::<u32>();
27 }