about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-04-30 14:08:26 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-04-30 14:08:26 +0000
commit84cb7ecbc1a54de37422a0bf3cc68987acb6610b (patch)
tree764655098eba17f4eea14131351a3f4a36966442
parent409661936f929b254ffc8adb644cf35d1f9765c4 (diff)
downloadrust-84cb7ecbc1a54de37422a0bf3cc68987acb6610b.tar.gz
rust-84cb7ecbc1a54de37422a0bf3cc68987acb6610b.zip
Remove wrong assertion.
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/check_match.rs3
-rw-r--r--tests/ui/match/guards-parenthesized-and.rs10
2 files changed, 10 insertions, 3 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
index 2b52d70af2a..66d29931400 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
@@ -334,9 +334,6 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
                     let refutable = !is_let_irrefutable(&mut ncx, local_lint_level, tpat);
                     Some((expr.span, refutable))
                 }
-                ExprKind::LogicalOp { op: LogicalOp::And, .. } => {
-                    bug!()
-                }
                 _ => None,
             }
         };
diff --git a/tests/ui/match/guards-parenthesized-and.rs b/tests/ui/match/guards-parenthesized-and.rs
new file mode 100644
index 00000000000..3a1c341f3ee
--- /dev/null
+++ b/tests/ui/match/guards-parenthesized-and.rs
@@ -0,0 +1,10 @@
+// check-pass
+
+fn main() {
+    let c = 1;
+    let w = "T";
+    match Some(5) {
+        None if c == 1 && (w != "Y" && w != "E") => {}
+        _ => panic!(),
+    }
+}