summary refs log tree commit diff
path: root/src/test/mir-opt/const_prop/boxes.rs
blob: cf134dadf27890ea552083929b28b6c00817ef43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// compile-flags: -O
// ignore-emscripten compiled with panic=abort by default
// ignore-wasm32
// ignore-wasm64

#![feature(box_syntax)]

// Note: this test verifies that we, in fact, do not const prop `box`

fn main() {
    let x = *(box 42) + 0;
}

// END RUST SOURCE
// START rustc.main.ConstProp.before.mir
//  bb0: {
//      ...
//      _4 = Box(i32);
//      (*_4) = const 42i32;
//      _3 = move _4;
//      ...
//      _2 = (*_3);
//      _1 = Add(move _2, const 0i32);
//      ...
//      drop(_3) -> [return: bb2, unwind: bb1];
//  }
//  bb1 (cleanup): {
//      resume;
//  }
//  bb2: {
//      ...
//      _0 = ();
//      ...
//  }
// END rustc.main.ConstProp.before.mir
// START rustc.main.ConstProp.after.mir
//  bb0: {
//      ...
//      _4 = Box(i32);
//      (*_4) = const 42i32;
//      _3 = move _4;
//      ...
//      _2 = (*_3);
//      _1 = Add(move _2, const 0i32);
//      ...
//      drop(_3) -> [return: bb2, unwind: bb1];
//  }
//  bb1 (cleanup): {
//      resume;
//  }
//  bb2: {
//      ...
//      _0 = ();
//      ...
//  }
// END rustc.main.ConstProp.after.mir