diff options
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/usefulness.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/usefulness.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index 99d1f46e804..bbe02f94c0a 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -716,7 +716,7 @@ use std::fmt; use crate::constructor::{Constructor, ConstructorSet, IntRange}; use crate::pat::{DeconstructedPat, PatId, PatOrWild, WitnessPat}; -use crate::{Captures, MatchArm, SkipField, TypeCx}; +use crate::{Captures, MatchArm, PrivateUninhabitedField, TypeCx}; use self::ValidityConstraint::*; @@ -817,9 +817,9 @@ impl fmt::Display for ValidityConstraint { struct PlaceInfo<Cx: TypeCx> { /// The type of the place. ty: Cx::Ty, - /// Whether we must skip this field during analysis. This is used when a private field is empty, + /// Whether the place is a private uninhabited field. If so we skip this field during analysis /// so that we don't observe its emptiness. - skip: SkipField, + private_uninhabited: bool, /// Whether the place is known to contain valid data. validity: ValidityConstraint, /// Whether the place is the scrutinee itself or a subplace of it. @@ -836,9 +836,9 @@ impl<Cx: TypeCx> PlaceInfo<Cx> { ) -> impl Iterator<Item = Self> + ExactSizeIterator + Captures<'a> { let ctor_sub_tys = cx.ctor_sub_tys(ctor, &self.ty); let ctor_sub_validity = self.validity.specialize(ctor); - ctor_sub_tys.map(move |(ty, skip)| PlaceInfo { + ctor_sub_tys.map(move |(ty, PrivateUninhabitedField(private_uninhabited))| PlaceInfo { ty, - skip, + private_uninhabited, validity: ctor_sub_validity, is_scrutinee: false, }) @@ -860,9 +860,9 @@ impl<Cx: TypeCx> PlaceInfo<Cx> { where Cx: 'a, { - if matches!(self.skip, SkipField(true)) { + if self.private_uninhabited { // Skip the whole column - return Ok((smallvec![Constructor::Skip], vec![])); + return Ok((smallvec![Constructor::PrivateUninhabited], vec![])); } let ctors_for_ty = cx.ctors_for_ty(&self.ty)?; @@ -925,7 +925,7 @@ impl<Cx: TypeCx> Clone for PlaceInfo<Cx> { fn clone(&self) -> Self { Self { ty: self.ty.clone(), - skip: self.skip, + private_uninhabited: self.private_uninhabited, validity: self.validity, is_scrutinee: self.is_scrutinee, } @@ -1137,7 +1137,7 @@ impl<'p, Cx: TypeCx> Matrix<'p, Cx> { ) -> Self { let place_info = PlaceInfo { ty: scrut_ty, - skip: SkipField(false), + private_uninhabited: false, validity: scrut_validity, is_scrutinee: true, }; |
