This commit is contained in:
Nadrieril 2024-06-27 11:24:05 +02:00
parent 536235f07e
commit 5df6f72057
2 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,62 @@
// MIR for `match_enum` after built
fn match_enum(_1: E1) -> bool {
debug x => _1;
let mut _0: bool;
let mut _2: isize;
let mut _3: isize;
bb0: {
PlaceMention(_1);
_2 = discriminant(_1);
switchInt(move _2) -> [0: bb3, 1: bb5, otherwise: bb2];
}
bb1: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb2: {
_3 = discriminant(_1);
switchInt(move _3) -> [2: bb8, otherwise: bb1];
}
bb3: {
goto -> bb7;
}
bb4: {
goto -> bb2;
}
bb5: {
goto -> bb7;
}
bb6: {
goto -> bb2;
}
bb7: {
falseEdge -> [real: bb10, imaginary: bb2];
}
bb8: {
_0 = const false;
goto -> bb11;
}
bb9: {
goto -> bb1;
}
bb10: {
_0 = const true;
goto -> bb11;
}
bb11: {
return;
}
}

View File

@ -9,4 +9,18 @@ fn match_bool(x: bool) -> usize {
}
}
pub enum E1 {
V1,
V2,
V3,
}
// EMIT_MIR simple_match.match_enum.built.after.mir
pub fn match_enum(x: E1) -> bool {
match x {
E1::V1 | E1::V2 => true,
E1::V3 => false,
}
}
fn main() {}