about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-05-09 15:39:28 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-10-24 15:30:17 +0000
commit687659f33f388b8fe531362fa74891c1d14915de (patch)
tree698ab6d361ab889d98d6cb8f02c9032185abd3e9
parent2dbbec34abbbfa83e73d7ed52cfc02258fa56b2d (diff)
downloadrust-687659f33f388b8fe531362fa74891c1d14915de.tar.gz
rust-687659f33f388b8fe531362fa74891c1d14915de.zip
Add diverging match guard test.
-rw-r--r--tests/ui/binding/issue-53114-borrow-checks.rs4
-rw-r--r--tests/ui/uninhabited/diverging-guard.rs10
2 files changed, 12 insertions, 2 deletions
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 {} } => (),
+    }
+}