Skip to content

Commit 5ee6897

Browse files
committed
Test for unihnabitded_enum_branching pass using reference to fields
1 parent 104a3c3 commit 5ee6897

3 files changed

+348
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching
2+
3+
fn main() -> () {
4+
let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum_branching2.rs:18:11: 18:11
5+
let _1: Plop; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13
6+
let mut _2: Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46
7+
let _3: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6
8+
let mut _4: &Test1; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22
9+
let mut _5: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20
10+
let _6: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34
11+
let _7: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24
12+
let _8: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24
13+
let _9: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6
14+
let mut _10: isize; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20
15+
let _11: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34
16+
let _12: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24
17+
let _13: &str; // in scope 0 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24
18+
scope 1 {
19+
debug plop => _1; // in scope 1 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13
20+
}
21+
22+
bb0: {
23+
StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:9: 19:13
24+
StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46
25+
discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:38: 19:46
26+
(_1.0: u32) = const 51_u32; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:16: 19:48
27+
(_1.1: Test1) = move _2; // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:16: 19:48
28+
StorageDead(_2); // scope 0 at $DIR/uninhabited_enum_branching2.rs:19:47: 19:48
29+
StorageLive(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6
30+
StorageLive(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22
31+
_4 = &(_1.1: Test1); // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:11: 21:22
32+
_5 = discriminant((*_4)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20
33+
switchInt(move _5) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, otherwise: bb1]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:9: 22:20
34+
}
35+
36+
bb1: {
37+
StorageLive(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24
38+
_8 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24
39+
// ty::Const
40+
// + ty: &str
41+
// + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
42+
// mir::Constant
43+
// + span: $DIR/uninhabited_enum_branching2.rs:25:21: 25:24
44+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
45+
_3 = &(*_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:21: 25:24
46+
StorageDead(_8); // scope 1 at $DIR/uninhabited_enum_branching2.rs:25:23: 25:24
47+
goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6
48+
}
49+
50+
bb2: {
51+
_3 = const "A(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:22:24: 22:34
52+
// ty::Const
53+
// + ty: &str
54+
// + val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
55+
// mir::Constant
56+
// + span: $DIR/uninhabited_enum_branching2.rs:22:24: 22:34
57+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
58+
goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6
59+
}
60+
61+
bb3: {
62+
StorageLive(_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34
63+
_6 = const "B(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34
64+
// ty::Const
65+
// + ty: &str
66+
// + val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
67+
// mir::Constant
68+
// + span: $DIR/uninhabited_enum_branching2.rs:23:24: 23:34
69+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
70+
_3 = &(*_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:24: 23:34
71+
StorageDead(_6); // scope 1 at $DIR/uninhabited_enum_branching2.rs:23:33: 23:34
72+
goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6
73+
}
74+
75+
bb4: {
76+
StorageLive(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24
77+
_7 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24
78+
// ty::Const
79+
// + ty: &str
80+
// + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
81+
// mir::Constant
82+
// + span: $DIR/uninhabited_enum_branching2.rs:24:21: 24:24
83+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
84+
_3 = &(*_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:21: 24:24
85+
StorageDead(_7); // scope 1 at $DIR/uninhabited_enum_branching2.rs:24:23: 24:24
86+
goto -> bb5; // scope 1 at $DIR/uninhabited_enum_branching2.rs:21:5: 26:6
87+
}
88+
89+
bb5: {
90+
StorageDead(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:26:6: 26:7
91+
StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:26:6: 26:7
92+
StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6
93+
_10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20
94+
switchInt(move _10) -> [0_isize: bb7, 1_isize: bb8, 2_isize: bb9, otherwise: bb6]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:9: 29:20
95+
}
96+
97+
bb6: {
98+
StorageLive(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24
99+
_13 = const "D"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24
100+
// ty::Const
101+
// + ty: &str
102+
// + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
103+
// mir::Constant
104+
// + span: $DIR/uninhabited_enum_branching2.rs:32:21: 32:24
105+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
106+
_9 = &(*_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:21: 32:24
107+
StorageDead(_13); // scope 1 at $DIR/uninhabited_enum_branching2.rs:32:23: 32:24
108+
goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6
109+
}
110+
111+
bb7: {
112+
_9 = const "A(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:29:24: 29:34
113+
// ty::Const
114+
// + ty: &str
115+
// + val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
116+
// mir::Constant
117+
// + span: $DIR/uninhabited_enum_branching2.rs:29:24: 29:34
118+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
119+
goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6
120+
}
121+
122+
bb8: {
123+
StorageLive(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34
124+
_11 = const "B(Empty)"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34
125+
// ty::Const
126+
// + ty: &str
127+
// + val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
128+
// mir::Constant
129+
// + span: $DIR/uninhabited_enum_branching2.rs:30:24: 30:34
130+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
131+
_9 = &(*_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:24: 30:34
132+
StorageDead(_11); // scope 1 at $DIR/uninhabited_enum_branching2.rs:30:33: 30:34
133+
goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6
134+
}
135+
136+
bb9: {
137+
StorageLive(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24
138+
_12 = const "C"; // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24
139+
// ty::Const
140+
// + ty: &str
141+
// + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
142+
// mir::Constant
143+
// + span: $DIR/uninhabited_enum_branching2.rs:31:21: 31:24
144+
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1], len: Size { raw: 1 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
145+
_9 = &(*_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:21: 31:24
146+
StorageDead(_12); // scope 1 at $DIR/uninhabited_enum_branching2.rs:31:23: 31:24
147+
goto -> bb10; // scope 1 at $DIR/uninhabited_enum_branching2.rs:28:5: 33:6
148+
}
149+
150+
bb10: {
151+
StorageDead(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:33:6: 33:7
152+
_0 = const (); // scope 0 at $DIR/uninhabited_enum_branching2.rs:18:11: 34:2
153+
StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching2.rs:34:1: 34:2
154+
return; // scope 0 at $DIR/uninhabited_enum_branching2.rs:34:2: 34:2
155+
}
156+
}

0 commit comments

Comments
 (0)