summaryrefslogtreecommitdiff
path: root/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff
blob: 8a8cd896e85db1f2c0d3fa1f1af36077cf2d31e2 (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
- // MIR for `unwrap_unchecked` before Inline
+ // MIR for `unwrap_unchecked` after Inline
  
  fn unwrap_unchecked(_1: Option<T>) -> T {
      debug slf => _1;                     // in scope 0 at $DIR/unwrap_unchecked.rs:+0:35: +0:38
      let mut _0: T;                       // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55
      let mut _2: std::option::Option<T>;  // in scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8
+     scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27
+         debug self => _2;                // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
+         let mut _3: &std::option::Option<T>; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
+         let mut _4: isize;               // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
+         scope 2 {
+             debug val => _0;             // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
+         }
+         scope 3 {
+             scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
+                 scope 6 {
+                     scope 7 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+                     }
+                 }
+             }
+         }
+         scope 4 (inlined Option::<T>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
+             debug self => _3;            // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
+         }
+     }
  
      bb0: {
          StorageLive(_2);                 // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8
          _2 = move _1;                    // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:8
-         _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/unwrap_unchecked.rs:+1:5: +1:27
-                                          // mir::Constant
-                                          // + span: $DIR/unwrap_unchecked.rs:10:9: 10:25
-                                          // + literal: Const { ty: unsafe fn(Option<T>) -> T {Option::<T>::unwrap_unchecked}, val: Value(<ZST>) }
+         StorageLive(_3);                 // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27
+         _4 = discriminant(_2);           // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
+         switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
      }
  
      bb1: {
-         StorageDead(_2);                 // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27
-         return;                          // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2
+         unreachable;                     // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
      }
  
-     bb2 (cleanup): {
-         resume;                          // scope 0 at $DIR/unwrap_unchecked.rs:+0:1: +2:2
+     bb2: {
+         _0 = move ((_2 as Some).0: T);   // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
+         StorageDead(_3);                 // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27
+         StorageDead(_2);                 // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27
+         return;                          // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2
      }
  }