summary refs log tree commit diff
path: root/src/test/mir-opt/const_prop/checked_add.rs
blob: fe98cf24eec009ecc6416033e5b7a38e787a6dae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// compile-flags: -C overflow-checks=on

fn main() {
    let x: u32 = 1 + 1;
}

// END RUST SOURCE
// START rustc.main.ConstProp.before.mir
//  bb0: {
//      ...
//      _2 = CheckedAdd(const 1u32, const 1u32);
//      assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1;
//  }
// END rustc.main.ConstProp.before.mir
// START rustc.main.ConstProp.after.mir
//  bb0: {
//      ...
//      _2 = (const 2u32, const false);
//      assert(!const false, "attempt to add with overflow") -> bb1;
//  }
// END rustc.main.ConstProp.after.mir