]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const-eval-overflow-4.rs
0b12a438f966233ace4dd1e6bc3c76a0642e0f47
[rust.git] / src / test / ui / consts / const-eval / const-eval-overflow-4.rs
1 // Evaluation of constants in array-elem count goes through different
2 // compiler control-flow paths.
3 //
4 // This test is checking the count in an array type.
5
6 #![allow(unused_imports)]
7
8 use std::fmt;
9 use std::{i8, i16, i32, i64, isize};
10 use std::{u8, u16, u32, u64, usize};
11
12 const A_I8_T
13     : [u32; (i8::MAX as i8 + 1i8) as usize]
14     //~^ ERROR evaluation of constant value failed
15     = [0; (i8::MAX as usize) + 1];
16
17 fn main() {
18     foo(&A_I8_T[..]);
19 }
20
21 fn foo<T:fmt::Debug>(x: T) {
22     println!("{:?}", x);
23 }