From 687659f33f388b8fe531362fa74891c1d14915de Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 9 May 2023 15:39:28 +0000 Subject: [PATCH] Add diverging match guard test. --- tests/ui/binding/issue-53114-borrow-checks.rs | 4 ++-- tests/ui/uninhabited/diverging-guard.rs | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 tests/ui/uninhabited/diverging-guard.rs diff --git a/tests/ui/binding/issue-53114-borrow-checks.rs b/tests/ui/binding/issue-53114-borrow-checks.rs index 8b4ebe7265a..6ab1f4f47df 100644 --- a/tests/ui/binding/issue-53114-borrow-checks.rs +++ b/tests/ui/binding/issue-53114-borrow-checks.rs @@ -20,7 +20,7 @@ fn let_wild_gets_moved_expr() { fn match_moved_expr_to_wild() { let m = M; drop(m); - match m { _ => { } } // #53114: should eventually be accepted too + match m { _ => { } } // #53114: accepted too let mm = (M, M); // variation on above with `_` in substructure match mm { (_x, _) => { } } @@ -31,7 +31,7 @@ fn match_moved_expr_to_wild() { fn if_let_moved_expr_to_wild() { let m = M; drop(m); - if let _ = m { } // #53114: should eventually be accepted too + if let _ = m { } // #53114: accepted too let mm = (M, M); // variation on above with `_` in substructure if let (_x, _) = mm { } diff --git a/tests/ui/uninhabited/diverging-guard.rs b/tests/ui/uninhabited/diverging-guard.rs new file mode 100644 index 00000000000..7d57cd51c2d --- /dev/null +++ b/tests/ui/uninhabited/diverging-guard.rs @@ -0,0 +1,10 @@ +// check-pass + +enum Void {} + +fn main() { + let x: Void; + match x { + _ if { loop {} } => (), + } +}