From ae40f6a7ffdda1f58794e25db2d8c9798cfe1e40 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 26 Dec 2023 02:06:39 +0000 Subject: [PATCH] Clean up more lifetimes --- compiler/rustc_pattern_analysis/src/constructor.rs | 7 ++----- compiler/rustc_pattern_analysis/src/pat.rs | 10 ++++------ compiler/rustc_pattern_analysis/src/rustc.rs | 8 ++++---- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index b688051ca9c..15ff4ceb5b3 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -861,12 +861,9 @@ impl ConstructorSet { #[instrument(level = "debug", skip(self, pcx, ctors), ret)] pub(crate) fn split<'a>( &self, - pcx: &PlaceCtxt<'_, '_, Cx>, + pcx: &PlaceCtxt<'a, '_, Cx>, ctors: impl Iterator> + Clone, - ) -> SplitConstructorSet - where - Cx: 'a, - { + ) -> SplitConstructorSet { let mut present: SmallVec<[_; 1]> = SmallVec::new(); // Empty constructors found missing. let mut missing_empty = Vec::new(); diff --git a/compiler/rustc_pattern_analysis/src/pat.rs b/compiler/rustc_pattern_analysis/src/pat.rs index 70d829f236c..db41d2824a1 100644 --- a/compiler/rustc_pattern_analysis/src/pat.rs +++ b/compiler/rustc_pattern_analysis/src/pat.rs @@ -71,17 +71,15 @@ impl<'p, Cx: TypeCx> DeconstructedPat<'p, Cx> { self.data.as_ref() } - pub fn iter_fields<'a>( - &'a self, - ) -> impl Iterator> + Captures<'a> { + pub fn iter_fields(&self) -> impl Iterator> + Captures<'_> { self.fields.iter() } /// Specialize this pattern with a constructor. /// `other_ctor` can be different from `self.ctor`, but must be covered by it. - pub(crate) fn specialize<'a>( + pub(crate) fn specialize( &self, - pcx: &PlaceCtxt<'a, 'p, Cx>, + pcx: &PlaceCtxt<'_, 'p, Cx>, other_ctor: &Constructor, ) -> SmallVec<[&'p DeconstructedPat<'p, Cx>; 2]> { let wildcard_sub_tys = || { @@ -196,7 +194,7 @@ impl WitnessPat { self.ty } - pub fn iter_fields<'a>(&'a self) -> impl Iterator> { + pub fn iter_fields(&self) -> impl Iterator> { self.fields.iter() } } diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index 1f5f8f2ce6d..84aa6a0bbfd 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -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 // uninhabited fields in order not to reveal the uninhabitedness of the whole variant. // This lists the fields we keep along with their types. - pub(crate) fn list_variant_nonhidden_fields<'a>( - &'a self, + pub(crate) fn list_variant_nonhidden_fields( + &self, ty: Ty<'tcx>, - variant: &'a VariantDef, // TODO: - ) -> impl Iterator)> + Captures<'p> + Captures<'a> { + variant: &'tcx VariantDef, + ) -> impl Iterator)> + Captures<'p> + Captures<'_> { let cx = self; let ty::Adt(adt, args) = ty.kind() else { bug!() }; // Whether we must not match the fields of this variant exhaustively.