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

Recover suggestions to introduce named lifetime under NLL #96409

Merged

Conversation

marmeladema
Copy link
Contributor

Fixes #96157

r? @jackh726

Built on top of #96385 so only the second commit is relevant

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 25, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 25, 2022
| hir::Node::TraitItem(&hir::TraitItem { ref generics, .. })
| hir::Node::ImplItem(&hir::ImplItem { ref generics, .. }) => generics,
_ => return,
pub fn suggest_adding_lifetime_params<'tcx>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method moved as a free standing function

self.suggest_adding_lifetime_params(sub, ty_sup, ty_sub, &mut err);
if suggest_adding_lifetime_params(self.tcx(), sub, ty_sup, ty_sub, &mut err) {
err.note("each elided lifetime in input position becomes a distinct lifetime");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note was originally in suggest_adding_lifetime_params but by moving it here we can avoid having the note under NLL.
However if we do want the note, I can just move it back to where it comes from

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The note is kind of redundant with the NLL error output, I guess.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits but overall LGTM

compiler/rustc_borrowck/src/diagnostics/region_errors.rs Outdated Show resolved Hide resolved
compiler/rustc_borrowck/src/diagnostics/region_errors.rs Outdated Show resolved Hide resolved
self.suggest_adding_lifetime_params(sub, ty_sup, ty_sub, &mut err);
if suggest_adding_lifetime_params(self.tcx(), sub, ty_sup, ty_sub, &mut err) {
err.note("each elided lifetime in input position becomes a distinct lifetime");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The note is kind of redundant with the NLL error output, I guess.

@bors
Copy link
Contributor

bors commented Apr 27, 2022

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

@marmeladema marmeladema force-pushed the fix-nll-introduce-named-lifetime-suggestion branch from cee7629 to 2c94218 Compare April 27, 2022 20:36
@jackh726
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 28, 2022

📌 Commit 2c94218 has been approved by jackh726

@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 Apr 28, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 28, 2022
…-lifetime-suggestion, r=jackh726

Recover suggestions to introduce named lifetime under NLL

Fixes rust-lang#96157

r? `@jackh726`

Built on top of rust-lang#96385 so only the second commit is relevant
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 28, 2022
…-lifetime-suggestion, r=jackh726

Recover suggestions to introduce named lifetime under NLL

Fixes rust-lang#96157

r? ``@jackh726``

Built on top of rust-lang#96385 so only the second commit is relevant
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#95312 (Ensure that `'_` and GAT yields errors)
 - rust-lang#96405 (Migrate ambiguous plus diagnostic to the new derive macro)
 - rust-lang#96409 (Recover suggestions to introduce named lifetime under NLL)
 - rust-lang#96433 (rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`)
 - rust-lang#96480 (Fixed grammatical error in example comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cbfbc3b into rust-lang:master Apr 28, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 28, 2022
@marmeladema marmeladema deleted the fix-nll-introduce-named-lifetime-suggestion branch April 28, 2022 22:10
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.

[NLL] Loss of suggestion to introduce a named lifetime parameter
5 participants