From 84cb7ecbc1a54de37422a0bf3cc68987acb6610b Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 30 Apr 2023 14:08:26 +0000 Subject: [PATCH] Remove wrong assertion. --- .../rustc_mir_build/src/thir/pattern/check_match.rs | 3 --- tests/ui/match/guards-parenthesized-and.rs | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tests/ui/match/guards-parenthesized-and.rs 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 2b52d70af2a44..66d29931400f1 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 0000000000000..3a1c341f3ee5a --- /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!(), + } +}