-
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
Recover suggestions to introduce named lifetime under NLL #96409
Recover suggestions to introduce named lifetime under NLL #96409
Conversation
| hir::Node::TraitItem(&hir::TraitItem { ref generics, .. }) | ||
| hir::Node::ImplItem(&hir::ImplItem { ref generics, .. }) => generics, | ||
_ => return, | ||
pub fn suggest_adding_lifetime_params<'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.
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"); | ||
} |
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.
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
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.
Hmm. The note is kind of redundant with the NLL error output, I guess.
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.
Some nits but overall LGTM
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"); | ||
} |
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.
Hmm. The note is kind of redundant with the NLL error output, I guess.
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs
Outdated
Show resolved
Hide resolved
☔ The latest upstream changes (presumably #96459) made this pull request unmergeable. Please resolve the merge conflicts. |
cee7629
to
2c94218
Compare
@bors r+ |
📌 Commit 2c94218 has been approved by |
…-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
…-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
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
Fixes #96157
r? @jackh726
Built on top of #96385 so only the second commit is relevant