]>
Commit | Line | Data |
---|---|---|
0531ce1d XL |
1 | #![allow(unused_imports)] |
2 | ||
3 | // Note: the relevant lint pass here runs before some of the constant | |
0731742a | 4 | // evaluation below (e.g., that performed by codegen and llvm), so if you |
0531ce1d XL |
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; | |
0531ce1d | 11 | |
532ac7d7 | 12 | const VALS_I8: (i8,) = |
0531ce1d XL |
13 | ( |
14 | i8::MIN - 1, | |
0531ce1d | 15 | ); |
532ac7d7 | 16 | //~^^ ERROR any use of this value will cause an error |
0531ce1d | 17 | |
532ac7d7 | 18 | const VALS_I16: (i16,) = |
0531ce1d XL |
19 | ( |
20 | i16::MIN - 1, | |
0531ce1d | 21 | ); |
532ac7d7 | 22 | //~^^ ERROR any use of this value will cause an error |
0531ce1d | 23 | |
532ac7d7 | 24 | const VALS_I32: (i32,) = |
0531ce1d XL |
25 | ( |
26 | i32::MIN - 1, | |
0531ce1d | 27 | ); |
532ac7d7 | 28 | //~^^ ERROR any use of this value will cause an error |
0531ce1d | 29 | |
532ac7d7 | 30 | const VALS_I64: (i64,) = |
0531ce1d XL |
31 | ( |
32 | i64::MIN - 1, | |
0531ce1d | 33 | ); |
532ac7d7 | 34 | //~^^ ERROR any use of this value will cause an error |
0531ce1d | 35 | |
532ac7d7 | 36 | const VALS_U8: (u8,) = |
0531ce1d XL |
37 | ( |
38 | u8::MIN - 1, | |
0531ce1d | 39 | ); |
532ac7d7 | 40 | //~^^ ERROR any use of this value will cause an error |
0531ce1d | 41 | |
532ac7d7 | 42 | const VALS_U16: (u16,) = ( |
0531ce1d | 43 | u16::MIN - 1, |
0531ce1d | 44 | ); |
532ac7d7 | 45 | //~^^ ERROR any use of this value will cause an error |
0531ce1d | 46 | |
532ac7d7 | 47 | const VALS_U32: (u32,) = ( |
0531ce1d | 48 | u32::MIN - 1, |
0531ce1d | 49 | ); |
532ac7d7 | 50 | //~^^ ERROR any use of this value will cause an error |
0531ce1d | 51 | |
532ac7d7 | 52 | const VALS_U64: (u64,) = |
0531ce1d XL |
53 | ( |
54 | u64::MIN - 1, | |
0531ce1d | 55 | ); |
532ac7d7 | 56 | //~^^ ERROR any use of this value will cause an error |
0531ce1d XL |
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 | } |