]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
Update tests to remove old numeric constants
[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
14 const A_I8_I
15     : [u32; (i8::MAX as usize) + 1]
16     = [0; (i8::MAX + 1u8) as usize];
17 //~^ ERROR mismatched types
18 //~| ERROR cannot add `u8` to `i8`
19
20 fn main() {
21     foo(&A_I8_I[..]);
22 }
23
24 fn foo<T:fmt::Debug>(x: T) {
25     println!("{:?}", x);
26 }