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:
commit
07726e3bf2
@ -334,9 +334,6 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
|
|||||||
let refutable = !is_let_irrefutable(&mut ncx, local_lint_level, tpat);
|
let refutable = !is_let_irrefutable(&mut ncx, local_lint_level, tpat);
|
||||||
Some((expr.span, refutable))
|
Some((expr.span, refutable))
|
||||||
}
|
}
|
||||||
ExprKind::LogicalOp { op: LogicalOp::And, .. } => {
|
|
||||||
bug!()
|
|
||||||
}
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
10
tests/ui/match/guards-parenthesized-and.rs
Normal file
10
tests/ui/match/guards-parenthesized-and.rs
Normal 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!(),
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user