2018-03-06 05:43:02 -06:00
|
|
|
#![deny(exceeding_bitshifts, const_err)]
|
2014-11-01 03:10:02 -05:00
|
|
|
#![allow(unused_variables)]
|
2018-03-06 05:43:02 -06:00
|
|
|
#![allow(dead_code)]
|
2014-11-01 03:10:02 -05:00
|
|
|
|
|
|
|
fn main() {
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u8 << 7;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u8 << 8; //~ ERROR: attempt to shift left with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u16 << 15;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u16 << 16; //~ ERROR: attempt to shift left with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u32 << 31;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u32 << 32; //~ ERROR: attempt to shift left with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u64 << 63;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u64 << 64; //~ ERROR: attempt to shift left with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i8 << 7;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i8 << 8; //~ ERROR: attempt to shift left with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i16 << 15;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i16 << 16; //~ ERROR: attempt to shift left with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i32 << 31;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i32 << 32; //~ ERROR: attempt to shift left with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i64 << 63;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i64 << 64; //~ ERROR: attempt to shift left with overflow
|
2014-11-01 03:10:02 -05:00
|
|
|
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u8 >> 7;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u8 >> 8; //~ ERROR: attempt to shift right with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u16 >> 15;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u16 >> 16; //~ ERROR: attempt to shift right with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u32 >> 31;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u32 >> 32; //~ ERROR: attempt to shift right with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1u64 >> 63;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u64 >> 64; //~ ERROR: attempt to shift right with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i8 >> 7;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i8 >> 8; //~ ERROR: attempt to shift right with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i16 >> 15;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i16 >> 16; //~ ERROR: attempt to shift right with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i32 >> 31;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i32 >> 32; //~ ERROR: attempt to shift right with overflow
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = 1i64 >> 63;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1i64 >> 64; //~ ERROR: attempt to shift right with overflow
|
2014-11-01 03:10:02 -05:00
|
|
|
|
|
|
|
let n = 1u8;
|
2014-11-03 13:08:11 -06:00
|
|
|
let n = n << 7;
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = n << 8; //~ ERROR: attempt to shift left with overflow
|
2014-11-01 03:10:02 -05:00
|
|
|
|
2018-03-06 05:43:02 -06:00
|
|
|
let n = 1u8 << -8; //~ ERROR: attempt to shift left with overflow
|
2018-01-16 02:28:27 -06:00
|
|
|
|
2015-06-30 10:53:50 -05:00
|
|
|
let n = 1i8<<(1isize+-1);
|
2014-11-01 03:10:02 -05:00
|
|
|
}
|