]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
ty: convert `ErrorHandled::Reported` to `ConstKind::Error`.
[rust.git] / src / test / ui / consts / const-eval / const-eval-overflow-3b.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 expression.
5 //
6 // This is a variation of another such test, but in this case the
7 // types for the left- and right-hand sides of the addition do not
8 // match (as well as overflow).
9
10 #![allow(unused_imports)]
11
12 use std::fmt;
13 use std::{i8, i16, i32, i64, isize};
14 use std::{u8, u16, u32, u64, usize};
15
16 const A_I8_I
17     : [u32; (i8::MAX as usize) + 1]
18     = [0; (i8::MAX + 1u8) as usize];
19 //~^ ERROR mismatched types
20 //~| ERROR cannot add `u8` to `i8`
21
22 fn main() {
23     foo(&A_I8_I[..]);
24 }
25
26 fn foo<T:fmt::Debug>(x: T) {
27     println!("{:?}", x);
28 }