1
Fork 0

Store field indices in DeconstructedPat to avoid virtual wildcards

This commit is contained in:
Nadrieril 2024-02-29 23:34:57 +01:00
parent c1e68860d0
commit 6ae9fa31f0
4 changed files with 102 additions and 84 deletions

View file

@ -917,7 +917,9 @@ fn report_arm_reachability<'p, 'tcx>(
fn pat_is_catchall(pat: &DeconstructedPat<'_, '_>) -> bool {
match pat.ctor() {
Constructor::Wildcard => true,
Constructor::Struct | Constructor::Ref => pat.iter_fields().all(|pat| pat_is_catchall(pat)),
Constructor::Struct | Constructor::Ref => {
pat.iter_fields().all(|ipat| pat_is_catchall(&ipat.pat))
}
_ => false,
}
}