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