]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-integer-bool-ops.rs
Do not suggest `let_else` if no bindings would be introduced
[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
10 const X1: usize = 42 || 39;
11 //~^ ERROR mismatched types
12 //~| expected `bool`, found integer
13 //~| ERROR mismatched types
14 //~| expected `bool`, found integer
15 //~| ERROR mismatched types
16 //~| expected `usize`, found `bool`
17 const ARR1: [i32; X1] = [99; 47];
18
19 const X2: usize = -42 || -39;
20 //~^ ERROR mismatched types
21 //~| expected `bool`, found integer
22 //~| ERROR mismatched types
23 //~| expected `bool`, found integer
24 //~| ERROR mismatched types
25 //~| expected `usize`, found `bool`
26 const ARR2: [i32; X2] = [99; 18446744073709551607];
27
28 const X3: usize = -42 && -39;
29 //~^ ERROR mismatched types
30 //~| expected `bool`, found integer
31 //~| ERROR mismatched types
32 //~| expected `bool`, found integer
33 //~| ERROR mismatched types
34 //~| expected `usize`, found `bool`
35 const ARR3: [i32; X3] = [99; 6];
36
37 const Y: usize = 42.0 == 42.0;
38 //~^ ERROR mismatched types
39 //~| expected `usize`, found `bool`
40 const ARRR: [i32; Y] = [99; 1];
41
42 const Y1: usize = 42.0 >= 42.0;
43 //~^ ERROR mismatched types
44 //~| expected `usize`, found `bool`
45 const ARRR1: [i32; Y1] = [99; 1];
46
47 const Y2: usize = 42.0 <= 42.0;
48 //~^ ERROR mismatched types
49 //~| expected `usize`, found `bool`
50 const ARRR2: [i32; Y2] = [99; 1];
51
52 const Y3: usize = 42.0 > 42.0;
53 //~^ ERROR mismatched types
54 //~| expected `usize`, found `bool`
55 const ARRR3: [i32; Y3] = [99; 0];
56
57 const Y4: usize = 42.0 < 42.0;
58 //~^ ERROR mismatched types
59 //~| expected `usize`, found `bool`
60 const ARRR4: [i32; Y4] = [99; 0];
61
62 const Y5: usize = 42.0 != 42.0;
63 //~^ ERROR mismatched types
64 //~| expected `usize`, found `bool`
65 const ARRR5: [i32; Y5] = [99; 0];
66
67 fn main() {
68     let _ = ARR;
69     let _ = ARRR;
70     let _ = ARRR1;
71     let _ = ARRR2;
72     let _ = ARRR3;
73     let _ = ARRR4;
74     let _ = ARRR5;
75 }