-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up some lifetimes in rustc_pattern_analysis
#119307
Conversation
Some changes might have occurred in exhaustiveness checking cc @Nadrieril |
Some changes might have occurred in exhaustiveness checking cc @Nadrieril Some changes occurred in cc @BoxyUwU |
@@ -75,11 +75,11 @@ enum LetSource { | |||
WhileLet, | |||
} | |||
|
|||
struct MatchVisitor<'thir, 'p, 'tcx> { | |||
struct MatchVisitor<'p, 'tcx> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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+ |
…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
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 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