Rollup merge of #111015 - cjgillot:chained-let-and, r=compiler-errors

Remove wrong assertion in match checking.

This assertions is completely misguided, introduced by https://github.com/rust-lang/rust/pull/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`
This commit is contained in:
Matthias Krüger 2023-05-01 01:09:48 +02:00 committed by GitHub
commit 07726e3bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -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,
}
};

View File

@ -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!(),
}
}