Skip to content

Commit 767b5e0

Browse files
committed
bless new test
1 parent 7cb54e7 commit 767b5e0

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// MIR for `result_ok` after ElaborateDrops
2+
3+
fn result_ok(_1: Result<String, ()>) -> Option<String> {
4+
debug result => _1;
5+
let mut _0: std::option::Option<std::string::String>;
6+
let mut _2: isize;
7+
let _3: std::string::String;
8+
let mut _4: std::string::String;
9+
let mut _5: bool;
10+
let mut _6: isize;
11+
let mut _7: isize;
12+
scope 1 {
13+
debug s => _3;
14+
}
15+
16+
bb0: {
17+
_5 = const false;
18+
_5 = const true;
19+
PlaceMention(_1);
20+
_2 = discriminant(_1);
21+
switchInt(move _2) -> [0: bb2, otherwise: bb1];
22+
}
23+
24+
bb1: {
25+
_0 = Option::<String>::None;
26+
goto -> bb5;
27+
}
28+
29+
bb2: {
30+
StorageLive(_3);
31+
_3 = move ((_1 as Ok).0: std::string::String);
32+
StorageLive(_4);
33+
_4 = move _3;
34+
_0 = Option::<String>::Some(move _4);
35+
goto -> bb3;
36+
}
37+
38+
bb3: {
39+
StorageDead(_4);
40+
goto -> bb4;
41+
}
42+
43+
bb4: {
44+
StorageDead(_3);
45+
goto -> bb5;
46+
}
47+
48+
bb5: {
49+
goto -> bb16;
50+
}
51+
52+
bb6: {
53+
return;
54+
}
55+
56+
bb7 (cleanup): {
57+
goto -> bb8;
58+
}
59+
60+
bb8 (cleanup): {
61+
goto -> bb9;
62+
}
63+
64+
bb9 (cleanup): {
65+
resume;
66+
}
67+
68+
bb10: {
69+
goto -> bb6;
70+
}
71+
72+
bb11 (cleanup): {
73+
goto -> bb9;
74+
}
75+
76+
bb12 (cleanup): {
77+
goto -> bb9;
78+
}
79+
80+
bb13: {
81+
goto -> bb10;
82+
}
83+
84+
bb14: {
85+
goto -> bb10;
86+
}
87+
88+
bb15 (cleanup): {
89+
goto -> bb9;
90+
}
91+
92+
bb16: {
93+
_6 = discriminant(_1);
94+
switchInt(move _6) -> [0: bb13, otherwise: bb14];
95+
}
96+
97+
bb17 (cleanup): {
98+
_7 = discriminant(_1);
99+
switchInt(move _7) -> [0: bb11, otherwise: bb15];
100+
}
101+
}

tests/mir-opt/otherwise_drops.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
// skip-filecheck
12
//@ test-mir-pass: ElaborateDrops
23

4+
// Ensures there are no drops for the wildcard match arm.
5+
36
// EMIT_MIR otherwise_drops.result_ok.ElaborateDrops.after.mir
47
fn result_ok(result: Result<String, ()>) -> Option<String> {
58
match result {

0 commit comments

Comments
 (0)