]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/inhabited-assoc-ty-ice-1.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / const-generics / inhabited-assoc-ty-ice-1.rs
1 // run-pass
2 #![feature(generic_const_exprs)]
3 #![allow(incomplete_features)]
4
5 // This tests that the inhabited check 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 #[allow(unused_tuple_struct_fields)]
13 struct Iced<T: Foo>(T, [(); T::ASSOC])
14 where
15     [(); T::ASSOC]: ;
16
17 impl Foo for u32 {}
18
19 fn foo<T: Foo>()
20 where
21     [(); T::ASSOC]: ,
22 {
23     let _iced: Iced<T> = return;
24 }
25
26 fn main() {
27     foo::<u32>();
28 }