Skip to content

Clean up some lifetimes in rustc_pattern_analysis #119307

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 6 commits into from
Dec 26, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Dec 26, 2023

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 26, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 26, 2023

Some changes might have occurred in exhaustiveness checking

cc @Nadrieril

@rustbot
Copy link
Collaborator

rustbot commented Dec 26, 2023

Some changes might have occurred in exhaustiveness checking

cc @Nadrieril

Some changes occurred in rustc_ty_utils::consts.rs

cc @BoxyUwU

@@ -75,11 +75,11 @@ enum LetSource {
WhileLet,
}

struct MatchVisitor<'thir, 'p, 'tcx> {
struct MatchVisitor<'p, 'tcx> {
Copy link
Member Author

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.

@Nadrieril
Copy link
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+

@bors
Copy link
Collaborator

bors commented Dec 26, 2023

📌 Commit 48d089a has been approved by Nadrieril

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 26, 2023
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
@bors bors merged commit e1be642 into rust-lang:master Dec 26, 2023
@rustbot rustbot added this to the 1.77.0 milestone Dec 26, 2023
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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants