Clean up some lifetimes in rustc_pattern_analysis#119307
Merged
bors merged 6 commits intorust-lang:masterfrom Dec 26, 2023
Merged
Clean up some lifetimes in rustc_pattern_analysis#119307bors merged 6 commits intorust-lang:masterfrom
rustc_pattern_analysis#119307bors merged 6 commits intorust-lang:masterfrom
Conversation
Collaborator
|
Some changes might have occurred in exhaustiveness checking cc @Nadrieril |
Collaborator
|
Some changes might have occurred in exhaustiveness checking cc @Nadrieril Some changes occurred in cc @BoxyUwU |
compiler-errors
commented
Dec 26, 2023
| } | ||
|
|
||
| struct MatchVisitor<'thir, 'p, 'tcx> { | ||
| struct MatchVisitor<'p, 'tcx> { |
Contributor
Author
There was a problem hiding this comment.
We're very lucky that 'thir is covariant here -- that means that we can shorten it to 'p, which is the lifetime of our pattern interner.
Member
|
Amazing :D I'm not sure how I ended up concluding that a separate lifetime was necessary but I don't mind being wrong. @bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 26, 2023
…mpiler-errors Rollup of 5 pull requests Successful merges: - rust-lang#119235 (Add missing feature gate for sanitizer CFI cfgs) - rust-lang#119240 (Make some non-diagnostic-affecting `QPath::LangItem` into regular `QPath`s) - rust-lang#119297 (Pass DeadItem and lint as consistent group in dead-code.) - rust-lang#119307 (Clean up some lifetimes in `rustc_pattern_analysis`) - rust-lang#119323 (add test for coercing never to infinite type) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 26, 2023
Rollup merge of rust-lang#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 0292eb9, and then simplified more lifetimes in `MatchVisitor`, which should make rust-lang#119233 a very simple PR! r? Nadrieril
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 0292eb9, and then simplified more lifetimes in
MatchVisitor, which should make #119233 a very simple PR!r? Nadrieril