diff options
| author | Michael Goulet <michael@errs.io> | 2023-12-26 13:29:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-26 13:29:14 -0500 |
| commit | e1be642b41a79bd23b46aaa229cac4e23638b169 (patch) | |
| tree | 523210bd477925f28b5c6aca115973d79ef297c1 /compiler/rustc_pattern_analysis/src/rustc.rs | |
| parent | 65aaece6c0d09ec0129088c6abc203612c9e39d0 (diff) | |
| parent | 48d089a8002d57f0c7b473905bc1925e99bcc76d (diff) | |
| download | rust-e1be642b41a79bd23b46aaa229cac4e23638b169.tar.gz rust-e1be642b41a79bd23b46aaa229cac4e23638b169.zip | |
Rollup merge of #119307 - compiler-errors:pat-lifetimes, r=Nadrieril
Clean up some lifetimes in `rustc_pattern_analysis` This PR removes some redundant lifetimes. I figured out that we were shortening the lifetime of an arena-allocated `&'p DeconstructedPat<'p>` to `'a DeconstructedPat<'p>`, which forced us to carry both lifetimes when we could otherwise carry just one. This PR also removes and elides some unnecessary lifetimes. I also cherry-picked 0292eb9bb9b897f5c0926c6a8530877f67e7cc9b, and then simplified more lifetimes in `MatchVisitor`, which should make #119233 a very simple PR! r? Nadrieril
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/rustc.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/rustc.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index a5a47724f3f..e9922f621b7 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, - ) -> impl Iterator<Item = (FieldIdx, Ty<'tcx>)> + Captures<'p> + Captures<'a> { + variant: &'tcx VariantDef, + ) -> impl Iterator<Item = (FieldIdx, Ty<'tcx>)> + 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. @@ -399,7 +399,7 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> { /// Note: the input patterns must have been lowered through /// `rustc_mir_build::thir::pattern::check_match::MatchVisitor::lower_pattern`. - pub fn lower_pat(&self, pat: &Pat<'tcx>) -> DeconstructedPat<'p, 'tcx> { + pub fn lower_pat(&self, pat: &'p Pat<'tcx>) -> DeconstructedPat<'p, 'tcx> { let singleton = |pat| std::slice::from_ref(self.pattern_arena.alloc(pat)); let cx = self; let ctor; |
