]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mir/mir_overflow_off.rs
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
[rust.git] / src / test / ui / mir / mir_overflow_off.rs
1 // run-pass
2 // compile-flags: -Z force-overflow-checks=off
3
4 // Test that with MIR codegen, overflow checks can be
5 // turned off, even when they're from core::ops::*.
6
7 use std::ops::*;
8
9 fn main() {
10     assert_eq!(i8::neg(-0x80), -0x80);
11
12     assert_eq!(u8::add(0xff, 1), 0_u8);
13     assert_eq!(u8::sub(0, 1), 0xff_u8);
14     assert_eq!(u8::mul(0xff, 2), 0xfe_u8);
15     assert_eq!(u8::shl(1, 9), 2_u8);
16     assert_eq!(u8::shr(2, 9), 1_u8);
17 }