16
16
fn main ( ) {
17
17
let n = 1u8 << 7 ;
18
18
let n = 1u8 << 8 ; //~ ERROR: bitshift exceeds the type's number of bits
19
- //~^ WARN: attempted to shift left with overflow
20
19
let n = 1u16 << 15 ;
21
20
let n = 1u16 << 16 ; //~ ERROR: bitshift exceeds the type's number of bits
22
- //~^ WARN: attempted to shift left with overflow
23
21
let n = 1u32 << 31 ;
24
22
let n = 1u32 << 32 ; //~ ERROR: bitshift exceeds the type's number of bits
25
- //~^ WARN: attempted to shift left with overflow
26
23
let n = 1u64 << 63 ;
27
24
let n = 1u64 << 64 ; //~ ERROR: bitshift exceeds the type's number of bits
28
- //~^ WARN: attempted to shift left with overflow
29
25
let n = 1i8 << 7 ;
30
26
let n = 1i8 << 8 ; //~ ERROR: bitshift exceeds the type's number of bits
31
- //~^ WARN: attempted to shift left with overflow
32
27
let n = 1i16 << 15 ;
33
28
let n = 1i16 << 16 ; //~ ERROR: bitshift exceeds the type's number of bits
34
- //~^ WARN: attempted to shift left with overflow
35
29
let n = 1i32 << 31 ;
36
30
let n = 1i32 << 32 ; //~ ERROR: bitshift exceeds the type's number of bits
37
- //~^ WARN: attempted to shift left with overflow
38
31
let n = 1i64 << 63 ;
39
32
let n = 1i64 << 64 ; //~ ERROR: bitshift exceeds the type's number of bits
40
- //~^ WARN: attempted to shift left with overflow
41
33
42
34
let n = 1u8 >> 7 ;
43
35
let n = 1u8 >> 8 ; //~ ERROR: bitshift exceeds the type's number of bits
44
- //~^ WARN: attempted to shift right with overflow
45
36
let n = 1u16 >> 15 ;
46
37
let n = 1u16 >> 16 ; //~ ERROR: bitshift exceeds the type's number of bits
47
- //~^ WARN: attempted to shift right with overflow
48
38
let n = 1u32 >> 31 ;
49
39
let n = 1u32 >> 32 ; //~ ERROR: bitshift exceeds the type's number of bits
50
- //~^ WARN: attempted to shift right with overflow
51
40
let n = 1u64 >> 63 ;
52
41
let n = 1u64 >> 64 ; //~ ERROR: bitshift exceeds the type's number of bits
53
- //~^ WARN: attempted to shift right with overflow
54
42
let n = 1i8 >> 7 ;
55
43
let n = 1i8 >> 8 ; //~ ERROR: bitshift exceeds the type's number of bits
56
- //~^ WARN: attempted to shift right with overflow
57
44
let n = 1i16 >> 15 ;
58
45
let n = 1i16 >> 16 ; //~ ERROR: bitshift exceeds the type's number of bits
59
- //~^ WARN: attempted to shift right with overflow
60
46
let n = 1i32 >> 31 ;
61
47
let n = 1i32 >> 32 ; //~ ERROR: bitshift exceeds the type's number of bits
62
- //~^ WARN: attempted to shift right with overflow
63
48
let n = 1i64 >> 63 ;
64
49
let n = 1i64 >> 64 ; //~ ERROR: bitshift exceeds the type's number of bits
65
- //~^ WARN: attempted to shift right with overflow
66
50
67
51
let n = 1u8 ;
68
52
let n = n << 7 ;
@@ -73,22 +57,18 @@ fn main() {
73
57
74
58
let n = 1u8 << ( 4 +3 ) ;
75
59
let n = 1u8 << ( 4 +4 ) ; //~ ERROR: bitshift exceeds the type's number of bits
76
- //~^ WARN: attempted to shift left with overflow
77
60
78
61
#[ cfg( target_pointer_width = "32" ) ]
79
62
const BITS : usize = 32 ;
80
63
#[ cfg( target_pointer_width = "64" ) ]
81
64
const BITS : usize = 64 ;
82
65
83
66
let n = 1_isize << BITS ; //~ ERROR: bitshift exceeds the type's number of bits
84
- //~^ WARN: attempted to shift left with overflow
85
67
let n = 1_usize << BITS ; //~ ERROR: bitshift exceeds the type's number of bits
86
- //~^ WARN: attempted to shift left with overflow
87
68
88
69
89
70
let n = 1i8 <<( 1isize +-1 ) ;
90
71
91
72
let n = 1i64 >> [ 63 ] [ 0 ] ;
92
73
let n = 1i64 >> [ 64 ] [ 0 ] ; //~ ERROR: bitshift exceeds the type's number of bits
93
- //~^ WARN: attempted to shift right with overflow
94
74
}
0 commit comments