Rollup merge of #119835 - Nadrieril:simplify-empty-logic, r=compiler-errors
Exhaustiveness: simplify empty pattern logic The logic that handles empty patterns had gotten quite convoluted. This PR simplifies it a lot. I tried to make the logic as easy as possible to follow; this only does logically equivalent changes. The first commit is a drive-by comment clarification that was requested after another PR a while back. r? `@compiler-errors`
This commit is contained in:
commit
2587100a9b
4 changed files with 30 additions and 51 deletions
|
@ -289,7 +289,8 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
|||
fn is_known_valid_scrutinee(&self, scrutinee: &Expr<'tcx>) -> bool {
|
||||
use ExprKind::*;
|
||||
match &scrutinee.kind {
|
||||
// Both pointers and references can validly point to a place with invalid data.
|
||||
// Pointers can validly point to a place with invalid data. It is undecided whether
|
||||
// references can too, so we conservatively assume they can.
|
||||
Deref { .. } => false,
|
||||
// Inherit validity of the parent place, unless the parent is an union.
|
||||
Field { lhs, .. } => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue