fork/rust
git clone https://git.julia.blue/fork/rust
49cae55760d
1.44.0
1// MIR for `unwrap` after SimplifyCfg-elaborate-drops 2 3fn unwrap(_1: std::option::Option<T>) -> T { 4 debug opt => _1; // in scope 0 at $DIR/no-drop-for-inactive-variant.rs:7:14: 7:17 5 let mut _0: T; // return place in scope 0 at $DIR/no-drop-for-inactive-variant.rs:7:33: 7:34 6 let mut _2: isize; // in scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:9: 9:16 7 let _3: T; // in scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:14: 9:15 8 let mut _4: !; // in scope 0 at $SRC_DIR/libstd/macros.rs:LL:COL 9 let mut _5: isize; // in scope 0 at $DIR/no-drop-for-inactive-variant.rs:12:1: 12:2 10 let mut _6: isize; // in scope 0 at $DIR/no-drop-for-inactive-variant.rs:12:1: 12:2 11 scope 1 { 12 debug x => _3; // in scope 1 at $DIR/no-drop-for-inactive-variant.rs:9:14: 9:15 13 } 14 15 bb0: { 16 _2 = discriminant(_1); // bb0[0]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:9: 9:16 17 switchInt(move _2) -> [0isize: bb2, 1isize: bb4, otherwise: bb3]; // bb0[1]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:9: 9:16 18 } 19 20 bb1 (cleanup): { 21 resume; // bb1[0]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:7:1: 12:2 22 } 23 24 bb2: { 25 StorageLive(_4); // bb2[0]: scope 0 at $SRC_DIR/libstd/macros.rs:LL:COL 26 const std::rt::begin_panic::<&str>(const "explicit panic") -> bb5; // bb2[1]: scope 0 at $SRC_DIR/libstd/macros.rs:LL:COL 27 // ty::Const 28 // + ty: fn(&str) -> ! {std::rt::begin_panic::<&str>} 29 // + val: Value(Scalar(<ZST>)) 30 // mir::Constant 31 // + span: $SRC_DIR/libstd/macros.rs:LL:COL 32 // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Scalar(<ZST>)) } 33 // ty::Const 34 // + ty: &str 35 // + val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 }) 36 // mir::Constant 37 // + span: $SRC_DIR/libstd/macros.rs:LL:COL 38 // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 }) } 39 } 40 41 bb3: { 42 unreachable; // bb3[0]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:8:11: 8:14 43 } 44 45 bb4: { 46 StorageLive(_3); // bb4[0]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:14: 9:15 47 _3 = move ((_1 as Some).0: T); // bb4[1]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:14: 9:15 48 _0 = move _3; // bb4[2]: scope 1 at $DIR/no-drop-for-inactive-variant.rs:9:20: 9:21 49 StorageDead(_3); // bb4[3]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:21: 9:22 50 _5 = discriminant(_1); // bb4[4]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:12:1: 12:2 51 return; // bb4[5]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:12:2: 12:2 52 } 53 54 bb5 (cleanup): { 55 drop(_1) -> bb1; // bb5[0]: scope 0 at $DIR/no-drop-for-inactive-variant.rs:12:1: 12:2 56 } 57}