|
12 | 12 | #![allow(unused_variables)] |
13 | 13 |
|
14 | 14 | fn main() { |
15 | | - let n = 1u8 << 8; |
16 | | - let n = 1u8 << 9; //~ ERROR: bitshift exceeds the type's number of bits |
17 | | - let n = 1u16 << 16; |
18 | | - let n = 1u16 << 17; //~ ERROR: bitshift exceeds the type's number of bits |
19 | | - let n = 1u32 << 32; |
20 | | - let n = 1u32 << 33; //~ ERROR: bitshift exceeds the type's number of bits |
21 | | - let n = 1u64 << 64; |
22 | | - let n = 1u64 << 65; //~ ERROR: bitshift exceeds the type's number of bits |
23 | | - let n = 1i8 << 8; |
24 | | - let n = 1i8 << 9; //~ ERROR: bitshift exceeds the type's number of bits |
25 | | - let n = 1i16 << 16; |
26 | | - let n = 1i16 << 17; //~ ERROR: bitshift exceeds the type's number of bits |
27 | | - let n = 1i32 << 32; |
28 | | - let n = 1i32 << 33; //~ ERROR: bitshift exceeds the type's number of bits |
29 | | - let n = 1i64 << 64; |
30 | | - let n = 1i64 << 65; //~ ERROR: bitshift exceeds the type's number of bits |
| 15 | + let n = 1u8 << 7; |
| 16 | + let n = 1u8 << 8; //~ ERROR: bitshift exceeds the type's number of bits |
| 17 | + let n = 1u16 << 15; |
| 18 | + let n = 1u16 << 16; //~ ERROR: bitshift exceeds the type's number of bits |
| 19 | + let n = 1u32 << 31; |
| 20 | + let n = 1u32 << 32; //~ ERROR: bitshift exceeds the type's number of bits |
| 21 | + let n = 1u64 << 63; |
| 22 | + let n = 1u64 << 64; //~ ERROR: bitshift exceeds the type's number of bits |
| 23 | + let n = 1i8 << 7; |
| 24 | + let n = 1i8 << 8; //~ ERROR: bitshift exceeds the type's number of bits |
| 25 | + let n = 1i16 << 15; |
| 26 | + let n = 1i16 << 16; //~ ERROR: bitshift exceeds the type's number of bits |
| 27 | + let n = 1i32 << 31; |
| 28 | + let n = 1i32 << 32; //~ ERROR: bitshift exceeds the type's number of bits |
| 29 | + let n = 1i64 << 63; |
| 30 | + let n = 1i64 << 64; //~ ERROR: bitshift exceeds the type's number of bits |
31 | 31 |
|
32 | | - let n = 1u8 >> 8; |
33 | | - let n = 1u8 >> 9; //~ ERROR: bitshift exceeds the type's number of bits |
34 | | - let n = 1u16 >> 16; |
35 | | - let n = 1u16 >> 17; //~ ERROR: bitshift exceeds the type's number of bits |
36 | | - let n = 1u32 >> 32; |
37 | | - let n = 1u32 >> 33; //~ ERROR: bitshift exceeds the type's number of bits |
38 | | - let n = 1u64 >> 64; |
39 | | - let n = 1u64 >> 65; //~ ERROR: bitshift exceeds the type's number of bits |
40 | | - let n = 1i8 >> 8; |
41 | | - let n = 1i8 >> 9; //~ ERROR: bitshift exceeds the type's number of bits |
42 | | - let n = 1i16 >> 16; |
43 | | - let n = 1i16 >> 17; //~ ERROR: bitshift exceeds the type's number of bits |
44 | | - let n = 1i32 >> 32; |
45 | | - let n = 1i32 >> 33; //~ ERROR: bitshift exceeds the type's number of bits |
46 | | - let n = 1i64 >> 64; |
47 | | - let n = 1i64 >> 65; //~ ERROR: bitshift exceeds the type's number of bits |
| 32 | + let n = 1u8 >> 7; |
| 33 | + let n = 1u8 >> 8; //~ ERROR: bitshift exceeds the type's number of bits |
| 34 | + let n = 1u16 >> 15; |
| 35 | + let n = 1u16 >> 16; //~ ERROR: bitshift exceeds the type's number of bits |
| 36 | + let n = 1u32 >> 31; |
| 37 | + let n = 1u32 >> 32; //~ ERROR: bitshift exceeds the type's number of bits |
| 38 | + let n = 1u64 >> 63; |
| 39 | + let n = 1u64 >> 64; //~ ERROR: bitshift exceeds the type's number of bits |
| 40 | + let n = 1i8 >> 7; |
| 41 | + let n = 1i8 >> 8; //~ ERROR: bitshift exceeds the type's number of bits |
| 42 | + let n = 1i16 >> 15; |
| 43 | + let n = 1i16 >> 16; //~ ERROR: bitshift exceeds the type's number of bits |
| 44 | + let n = 1i32 >> 31; |
| 45 | + let n = 1i32 >> 32; //~ ERROR: bitshift exceeds the type's number of bits |
| 46 | + let n = 1i64 >> 63; |
| 47 | + let n = 1i64 >> 64; //~ ERROR: bitshift exceeds the type's number of bits |
48 | 48 |
|
49 | 49 | let n = 1u8; |
50 | | - let n = n << 8; |
51 | | - let n = n << 9; //~ ERROR: bitshift exceeds the type's number of bits |
| 50 | + let n = n << 7; |
| 51 | + let n = n << 8; //~ ERROR: bitshift exceeds the type's number of bits |
52 | 52 |
|
53 | | - let n = 1u8 << -9; //~ ERROR: bitshift exceeds the type's number of bits |
| 53 | + let n = 1u8 << -8; //~ ERROR: bitshift exceeds the type's number of bits |
54 | 54 |
|
55 | | - let n = 1u8 << (4+4); |
56 | | - let n = 1u8 << (4+5); //~ ERROR: bitshift exceeds the type's number of bits |
| 55 | + let n = 1u8 << (4+3); |
| 56 | + let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits |
57 | 57 | } |
58 | 58 |
|
0 commit comments