summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/box_expr.main.ElaborateDrops.diff
blob: 88b12f19e64dfa9c006ed16e1495f68e49c9c705 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
- // MIR for `main` before ElaborateDrops
+ // MIR for `main` after ElaborateDrops
  
  fn main() -> () {
      let mut _0: ();
      let _1: std::boxed::Box<S>;
      let mut _2: usize;
      let mut _3: usize;
      let mut _4: *mut u8;
      let mut _5: std::boxed::Box<S>;
      let _6: ();
      let mut _7: std::boxed::Box<S>;
+     let mut _8: &mut std::boxed::Box<S>;
+     let mut _9: ();
      scope 1 {
          debug x => _1;
      }
      scope 2 {
      }
  
      bb0: {
          StorageLive(_1);
          _2 = SizeOf(S);
          _3 = AlignOf(S);
          _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
      }
  
      bb1: {
          StorageLive(_5);
          _5 = ShallowInitBox(move _4, S);
          (*_5) = S::new() -> [return: bb2, unwind: bb8];
      }
  
      bb2: {
          _1 = move _5;
-         drop(_5) -> [return: bb3, unwind continue];
+         goto -> bb3;
      }
  
      bb3: {
          StorageDead(_5);
          StorageLive(_6);
          StorageLive(_7);
          _7 = move _1;
          _6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6];
      }
  
      bb4: {
          StorageDead(_7);
          StorageDead(_6);
          _0 = const ();
-         drop(_1) -> [return: bb5, unwind continue];
+         goto -> bb5;
      }
  
      bb5: {
          StorageDead(_1);
          return;
      }
  
      bb6 (cleanup): {
-         drop(_7) -> [return: bb7, unwind terminate(cleanup)];
+         goto -> bb7;
      }
  
      bb7 (cleanup): {
-         drop(_1) -> [return: bb9, unwind terminate(cleanup)];
+         goto -> bb9;
      }
  
      bb8 (cleanup): {
-         drop(_5) -> [return: bb9, unwind terminate(cleanup)];
+         goto -> bb11;
      }
  
      bb9 (cleanup): {
          resume;
+     }
+ 
+     bb10 (cleanup): {
+         _8 = &mut _5;
+         _9 = <Box<S> as Drop>::drop(move _8) -> [return: bb9, unwind terminate(cleanup)];
+     }
+ 
+     bb11 (cleanup): {
+         goto -> bb10;
      }
  }