]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/generic_const_exprs/function-call.rs
Move generic error message to separate branches
[rust.git] / src / test / ui / const-generics / generic_const_exprs / function-call.rs
1 // check-pass
2
3 const fn foo<T>() -> usize {
4     // We might instead branch on `std::mem::size_of::<*mut T>() < 8` here,
5     // which would cause this function to fail on 32 bit systems.
6     if false {
7         std::mem::size_of::<T>()
8     } else {
9         8
10     }
11 }
12
13 fn test<T>() {
14     let _ = [0; foo::<T>()];
15     //~^ WARN cannot use constants which depend on generic parameters in types
16     //~| WARN this was previously accepted by the compiler but is being phased out
17 }
18
19 fn main() {}