summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-eval/const-eval-overflow2b.rs
blob: 9c3ad8ef9b44e5a9b9dae2b98d1721b703d36939 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#![allow(unused_imports)]

// Note: the relevant lint pass here runs before some of the constant
// evaluation below (e.g., that performed by codegen and llvm), so if you
// change this warn to a deny, then the compiler will exit before
// those errors are detected.

#![deny(const_err)]

use std::fmt;

const VALS_I8: (i8,) =
    (
     i8::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

const VALS_I16: (i16,) =
    (
     i16::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

const VALS_I32: (i32,) =
    (
     i32::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

const VALS_I64: (i64,) =
    (
     i64::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

const VALS_U8: (u8,) =
    (
     u8::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

const VALS_U16: (u16,) = (
     u16::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

const VALS_U32: (u32,) = (
     u32::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

const VALS_U64: (u64,) =
    (
     u64::MAX + 1,
     );
 //~^^ ERROR any use of this value will cause an error
 //~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
    foo(VALS_I8);
    foo(VALS_I16);
    foo(VALS_I32);
    foo(VALS_I64);

    foo(VALS_U8);
    foo(VALS_U16);
    foo(VALS_U32);
    foo(VALS_U64);
}

fn foo<T>(_: T) {
}