]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const-eval-overflow2c.rs
Update tests to remove old numeric constants
[rust.git] / src / test / ui / consts / const-eval / const-eval-overflow2c.rs
1 #![allow(unused_imports)]
2
3 // Note: the relevant lint pass here runs before some of the constant
4 // evaluation below (e.g., that performed by codegen and llvm), so if you
5 // change this warn to a deny, then the compiler will exit before
6 // those errors are detected.
7
8 #![deny(const_err)]
9
10 use std::fmt;
11
12 const VALS_I8: (i8,) =
13     (
14      i8::MIN * 2,
15      );
16  //~^^ ERROR any use of this value will cause an error
17
18 const VALS_I16: (i16,) =
19     (
20      i16::MIN * 2,
21      );
22  //~^^ ERROR any use of this value will cause an error
23
24 const VALS_I32: (i32,) =
25     (
26      i32::MIN * 2,
27      );
28  //~^^ ERROR any use of this value will cause an error
29
30 const VALS_I64: (i64,) =
31     (
32      i64::MIN * 2,
33      );
34  //~^^ ERROR any use of this value will cause an error
35
36 const VALS_U8: (u8,) =
37     (
38      u8::MAX * 2,
39      );
40  //~^^ ERROR any use of this value will cause an error
41
42 const VALS_U16: (u16,) = (
43      u16::MAX * 2,
44      );
45  //~^^ ERROR any use of this value will cause an error
46
47 const VALS_U32: (u32,) = (
48      u32::MAX * 2,
49      );
50  //~^^ ERROR any use of this value will cause an error
51
52 const VALS_U64: (u64,) =
53     (
54      u64::MAX * 2,
55      );
56  //~^^ ERROR any use of this value will cause an error
57
58 fn main() {
59     foo(VALS_I8);
60     foo(VALS_I16);
61     foo(VALS_I32);
62     foo(VALS_I64);
63
64     foo(VALS_U8);
65     foo(VALS_U16);
66     foo(VALS_U32);
67     foo(VALS_U64);
68 }
69
70 fn foo<T>(_: T) {
71 }