]>
Commit | Line | Data |
---|---|---|
92a42be0 SL |
1 | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
54a0048b | 11 | const X: usize = 42 && 39; //~ ERROR: can't do this op on integrals |
92a42be0 SL |
12 | const ARR: [i32; X] = [99; 34]; //~ NOTE: for array length here |
13 | ||
54a0048b | 14 | const X1: usize = 42 || 39; //~ ERROR: can't do this op on integrals |
92a42be0 SL |
15 | const ARR1: [i32; X1] = [99; 47]; //~ NOTE: for array length here |
16 | ||
54a0048b | 17 | const X2: usize = -42 || -39; //~ ERROR: unary negation of unsigned integer |
92a42be0 SL |
18 | const ARR2: [i32; X2] = [99; 18446744073709551607]; //~ NOTE: for array length here |
19 | ||
54a0048b | 20 | const X3: usize = -42 && -39; //~ ERROR: unary negation of unsigned integer |
92a42be0 SL |
21 | const ARR3: [i32; X3] = [99; 6]; //~ NOTE: for array length here |
22 | ||
23 | const Y: usize = 42.0 == 42.0; | |
54a0048b | 24 | const ARRR: [i32; Y] = [99; 1]; //~ ERROR: expected usize value for array length |
92a42be0 | 25 | const Y1: usize = 42.0 >= 42.0; |
54a0048b | 26 | const ARRR1: [i32; Y] = [99; 1]; //~ ERROR: expected usize value for array length |
92a42be0 | 27 | const Y2: usize = 42.0 <= 42.0; |
54a0048b | 28 | const ARRR2: [i32; Y] = [99; 1]; //~ ERROR: expected usize value for array length |
92a42be0 | 29 | const Y3: usize = 42.0 > 42.0; |
54a0048b | 30 | const ARRR3: [i32; Y] = [99; 0]; //~ ERROR: expected usize value for array length |
92a42be0 | 31 | const Y4: usize = 42.0 < 42.0; |
54a0048b | 32 | const ARRR4: [i32; Y] = [99; 0]; //~ ERROR: expected usize value for array length |
92a42be0 | 33 | const Y5: usize = 42.0 != 42.0; |
54a0048b | 34 | const ARRR5: [i32; Y] = [99; 0]; //~ ERROR: expected usize value for array length |
92a42be0 SL |
35 | |
36 | fn main() { | |
37 | let _ = ARR; | |
38 | let _ = ARRR; | |
39 | let _ = ARRR1; | |
40 | let _ = ARRR2; | |
41 | let _ = ARRR3; | |
42 | let _ = ARRR4; | |
43 | let _ = ARRR5; | |
44 | } |