Clean up more lifetimes

This commit is contained in:
Michael Goulet 2023-12-26 02:06:39 +00:00
parent b91a98ba10
commit ae40f6a7ff
3 changed files with 10 additions and 15 deletions

View File

@ -861,12 +861,9 @@ impl<Cx: TypeCx> ConstructorSet<Cx> {
#[instrument(level = "debug", skip(self, pcx, ctors), ret)] #[instrument(level = "debug", skip(self, pcx, ctors), ret)]
pub(crate) fn split<'a>( pub(crate) fn split<'a>(
&self, &self,
pcx: &PlaceCtxt<'_, '_, Cx>, pcx: &PlaceCtxt<'a, '_, Cx>,
ctors: impl Iterator<Item = &'a Constructor<Cx>> + Clone, ctors: impl Iterator<Item = &'a Constructor<Cx>> + Clone,
) -> SplitConstructorSet<Cx> ) -> SplitConstructorSet<Cx> {
where
Cx: 'a,
{
let mut present: SmallVec<[_; 1]> = SmallVec::new(); let mut present: SmallVec<[_; 1]> = SmallVec::new();
// Empty constructors found missing. // Empty constructors found missing.
let mut missing_empty = Vec::new(); let mut missing_empty = Vec::new();

View File

@ -71,17 +71,15 @@ impl<'p, Cx: TypeCx> DeconstructedPat<'p, Cx> {
self.data.as_ref() self.data.as_ref()
} }
pub fn iter_fields<'a>( pub fn iter_fields(&self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'_> {
&'a self,
) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'a> {
self.fields.iter() self.fields.iter()
} }
/// Specialize this pattern with a constructor. /// Specialize this pattern with a constructor.
/// `other_ctor` can be different from `self.ctor`, but must be covered by it. /// `other_ctor` can be different from `self.ctor`, but must be covered by it.
pub(crate) fn specialize<'a>( pub(crate) fn specialize(
&self, &self,
pcx: &PlaceCtxt<'a, 'p, Cx>, pcx: &PlaceCtxt<'_, 'p, Cx>,
other_ctor: &Constructor<Cx>, other_ctor: &Constructor<Cx>,
) -> SmallVec<[&'p DeconstructedPat<'p, Cx>; 2]> { ) -> SmallVec<[&'p DeconstructedPat<'p, Cx>; 2]> {
let wildcard_sub_tys = || { let wildcard_sub_tys = || {
@ -196,7 +194,7 @@ impl<Cx: TypeCx> WitnessPat<Cx> {
self.ty self.ty
} }
pub fn iter_fields<'a>(&'a self) -> impl Iterator<Item = &'a WitnessPat<Cx>> { pub fn iter_fields(&self) -> impl Iterator<Item = &WitnessPat<Cx>> {
self.fields.iter() self.fields.iter()
} }
} }

View File

@ -128,11 +128,11 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
// In the cases of either a `#[non_exhaustive]` field list or a non-public field, we hide // In the cases of either a `#[non_exhaustive]` field list or a non-public field, we hide
// uninhabited fields in order not to reveal the uninhabitedness of the whole variant. // uninhabited fields in order not to reveal the uninhabitedness of the whole variant.
// This lists the fields we keep along with their types. // This lists the fields we keep along with their types.
pub(crate) fn list_variant_nonhidden_fields<'a>( pub(crate) fn list_variant_nonhidden_fields(
&'a self, &self,
ty: Ty<'tcx>, ty: Ty<'tcx>,
variant: &'a VariantDef, // TODO: variant: &'tcx VariantDef,
) -> impl Iterator<Item = (FieldIdx, Ty<'tcx>)> + Captures<'p> + Captures<'a> { ) -> impl Iterator<Item = (FieldIdx, Ty<'tcx>)> + Captures<'p> + Captures<'_> {
let cx = self; let cx = self;
let ty::Adt(adt, args) = ty.kind() else { bug!() }; let ty::Adt(adt, args) = ty.kind() else { bug!() };
// Whether we must not match the fields of this variant exhaustively. // Whether we must not match the fields of this variant exhaustively.