Skip to content

Commit 07726e3

Browse files
authored
Rollup merge of #111015 - cjgillot:chained-let-and, r=compiler-errors
Remove wrong assertion in match checking. This assertions is completely misguided, introduced by #108504. The responsible PR is on beta, nominating for backport. Instead of checking that this is not a `&&`, it would make sense to check that neither arms of that `&&` is a `let`. This seems like a lot of code for unclear benefit. r? `@saethlin`
2 parents 1b262b8 + 84cb7ec commit 07726e3

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

-3
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,6 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
334334
let refutable = !is_let_irrefutable(&mut ncx, local_lint_level, tpat);
335335
Some((expr.span, refutable))
336336
}
337-
ExprKind::LogicalOp { op: LogicalOp::And, .. } => {
338-
bug!()
339-
}
340337
_ => None,
341338
}
342339
};
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
3+
fn main() {
4+
let c = 1;
5+
let w = "T";
6+
match Some(5) {
7+
None if c == 1 && (w != "Y" && w != "E") => {}
8+
_ => panic!(),
9+
}
10+
}

0 commit comments

Comments
 (0)