]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/issue-66693-panic-in-array-len.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / consts / issue-66693-panic-in-array-len.rs
1 // This is a separate test from `issue-66693.rs` because array lengths are evaluated
2 // in a separate stage before `const`s and `statics` and so the error below is hit and
3 // the compiler exits before generating errors for the others.
4
5 #![feature(const_panic)]
6
7 fn main() {
8 let _ = [0i32; panic!(2f32)];
9 //~^ ERROR: argument to `panic!()` in a const context must have type `&str`
10
11 // ensure that conforming panics are handled correctly
12 let _ = [false; panic!()];
13 //~^ ERROR: evaluation of constant value failed
14
15 // typechecking halts before getting to this one
16 let _ = ['a', panic!("panic in array len")];
17 }