]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const_evaluatable/function-call.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / const_evaluatable / 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() {}