2018-09-23 04:43:14 -05:00
|
|
|
// Test that the fake borrows for matches are removed after borrow checking.
|
|
|
|
|
2023-06-08 02:18:34 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2018-09-23 04:43:14 -05:00
|
|
|
|
2022-12-16 18:00:00 -06:00
|
|
|
// EMIT_MIR remove_fake_borrows.match_guard.CleanupPostBorrowck.diff
|
2019-02-02 04:56:55 -06:00
|
|
|
fn match_guard(x: Option<&&i32>, c: bool) -> i32 {
|
2018-09-23 04:43:14 -05:00
|
|
|
match x {
|
2019-02-02 04:56:55 -06:00
|
|
|
Some(0) if c => 0,
|
2018-09-23 04:43:14 -05:00
|
|
|
_ => 1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2019-02-02 04:56:55 -06:00
|
|
|
match_guard(None, true);
|
2018-09-23 04:43:14 -05:00
|
|
|
}
|