Skip to content
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

Compute lifetimes in scope at diagnostic time #97312

Merged
merged 3 commits into from
Jun 6, 2022

Conversation

cjgillot
Copy link
Contributor

The set of available lifetimes is currently computed during lifetime resolution on HIR. It is only used for one diagnostic.

In this PR, HIR lifetime resolution just reports whether elided lifetimes are well-defined at the place of use. The diagnostic code is responsible for building a list of lifetime names if elision is not allowed.

This will allow to remove lifetime resolution on HIR eventually.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 23, 2022
@rust-highfive
Copy link
Collaborator

r? @compiler-errors

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 23, 2022
@cjgillot cjgillot force-pushed the no-path-in-scope branch 2 times, most recently from 9a1f481 to 413e606 Compare June 3, 2022 10:05
@bors
Copy link
Contributor

bors commented Jun 3, 2022

☔ The latest upstream changes (presumably #97694) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot
Copy link
Contributor Author

cjgillot commented Jun 4, 2022

I wonder if we shouldn't just remove this query and always suggest named lifetimes.

@cjgillot
Copy link
Contributor Author

cjgillot commented Jun 5, 2022

I added 2 commits to remove the lifetime_scope_map. Having a dedicated query just for this diagnostic is IMO not worth the complexity. This is replaced by a specific suggestion for statics and consts to add 'static lifetime where appropriate.

@compiler-errors
Copy link
Member

This looks good.

@bors r+

@bors
Copy link
Contributor

bors commented Jun 5, 2022

📌 Commit f71ad2f has been approved by compiler-errors

@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 Jun 5, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#97312 (Compute lifetimes in scope at diagnostic time)
 - rust-lang#97495 (Add E0788 for improper #[no_coverage] usage)
 - rust-lang#97579 (Avoid creating `SmallVec`s in `global_llvm_features`)
 - rust-lang#97767 (interpret: do not claim UB until we looked more into variadic functions)
 - rust-lang#97787 (E0432: rust 2018 -> rust 2018 or later    in --explain message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a736acc into rust-lang:master Jun 6, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 6, 2022
@cjgillot cjgillot deleted the no-path-in-scope branch June 7, 2022 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

6 participants