]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs
min_const_generics: allow ty param in repeat expr
[rust.git] / src / test / ui / const-generics / min_const_generics / const-evaluatable-unchecked.rs
1 // check-pass
2 #![allow(dead_code)]
3
4 fn foo<T>() {
5     [0; std::mem::size_of::<*mut T>()];
6     //~^ WARN cannot use constants which depend on generic parameters in types
7     //~| WARN this was previously accepted by the compiler but is being phased out
8 }
9
10 struct Foo<T>(T);
11
12 impl<T> Foo<T> {
13     const ASSOC: usize = 4;
14
15     fn test() {
16         [0; Self::ASSOC];
17         //~^ WARN cannot use constants which depend on generic parameters in types
18         //~| WARN this was previously accepted by the compiler but is being phased out
19     }
20 }
21
22 fn main() {}