]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-integer-bool-ops.rs
Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
[rust.git] / src / test / ui / consts / const-integer-bool-ops.rs
1 const X: usize = 42 && 39;
2 //~^ ERROR mismatched types
3 //~| expected `bool`, found integer
4 //~| ERROR mismatched types
5 //~| expected `bool`, found integer
6 //~| ERROR mismatched types
7 //~| expected `usize`, found `bool`
8 const ARR: [i32; X] = [99; 34];
9 //~^ ERROR evaluation of constant value failed
10
11 const X1: usize = 42 || 39;
12 //~^ ERROR mismatched types
13 //~| expected `bool`, found integer
14 //~| ERROR mismatched types
15 //~| expected `bool`, found integer
16 //~| ERROR mismatched types
17 //~| expected `usize`, found `bool`
18 const ARR1: [i32; X1] = [99; 47];
19 //~^ ERROR evaluation of constant value failed
20
21 const X2: usize = -42 || -39;
22 //~^ ERROR mismatched types
23 //~| expected `bool`, found integer
24 //~| ERROR mismatched types
25 //~| expected `bool`, found integer
26 //~| ERROR mismatched types
27 //~| expected `usize`, found `bool`
28 const ARR2: [i32; X2] = [99; 18446744073709551607];
29 //~^ ERROR evaluation of constant value failed
30
31 const X3: usize = -42 && -39;
32 //~^ ERROR mismatched types
33 //~| expected `bool`, found integer
34 //~| ERROR mismatched types
35 //~| expected `bool`, found integer
36 //~| ERROR mismatched types
37 //~| expected `usize`, found `bool`
38 const ARR3: [i32; X3] = [99; 6];
39 //~^ ERROR evaluation of constant value failed
40
41 const Y: usize = 42.0 == 42.0;
42 //~^ ERROR mismatched types
43 //~| expected `usize`, found `bool`
44 const ARRR: [i32; Y] = [99; 1];
45 //~^ ERROR evaluation of constant value failed
46
47 const Y1: usize = 42.0 >= 42.0;
48 //~^ ERROR mismatched types
49 //~| expected `usize`, found `bool`
50 const ARRR1: [i32; Y1] = [99; 1];
51 //~^ ERROR evaluation of constant value failed
52
53 const Y2: usize = 42.0 <= 42.0;
54 //~^ ERROR mismatched types
55 //~| expected `usize`, found `bool`
56 const ARRR2: [i32; Y2] = [99; 1];
57 //~^ ERROR evaluation of constant value failed
58
59 const Y3: usize = 42.0 > 42.0;
60 //~^ ERROR mismatched types
61 //~| expected `usize`, found `bool`
62 const ARRR3: [i32; Y3] = [99; 0];
63 //~^ ERROR evaluation of constant value failed
64
65 const Y4: usize = 42.0 < 42.0;
66 //~^ ERROR mismatched types
67 //~| expected `usize`, found `bool`
68 const ARRR4: [i32; Y4] = [99; 0];
69 //~^ ERROR evaluation of constant value failed
70
71 const Y5: usize = 42.0 != 42.0;
72 //~^ ERROR mismatched types
73 //~| expected `usize`, found `bool`
74 const ARRR5: [i32; Y5] = [99; 0];
75 //~^ ERROR evaluation of constant value failed
76
77 fn main() {
78     let _ = ARR;
79     let _ = ARRR;
80     let _ = ARRR1;
81     let _ = ARRR2;
82     let _ = ARRR3;
83     let _ = ARRR4;
84     let _ = ARRR5;
85 }