2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2022-08-02 19:44:25 -05:00
|
|
|
// unit-test: ConstGoto
|
|
|
|
|
2020-10-03 04:18:24 -05:00
|
|
|
pub enum Foo {
|
|
|
|
A,
|
|
|
|
B,
|
|
|
|
C,
|
|
|
|
D,
|
|
|
|
E,
|
|
|
|
F,
|
|
|
|
}
|
|
|
|
|
|
|
|
// EMIT_MIR const_goto.issue_77355_opt.ConstGoto.diff
|
|
|
|
fn issue_77355_opt(num: Foo) -> u64 {
|
|
|
|
if matches!(num, Foo::B | Foo::C) { 23 } else { 42 }
|
|
|
|
}
|
|
|
|
fn main() {
|
|
|
|
issue_77355_opt(Foo::A);
|
|
|
|
}
|