-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix suggestions for missing return type lifetime specifiers #85050
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? @jackh726 |
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.
Initial comments
Thanks for your suggestions, @jackh726! I have just pushed a commit addressing your comments (those that I did not reply to above). |
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.
I think last comments :)
@jackh726 thanks again! I've implemented your suggested changes. |
Thanks! @bors r+ @FabianWolff in the future, it's best not to tag someone in the commit message itself, because they get pinged as the commit goes through CI and such :) |
📌 Commit 2448c76 has been approved by |
Ah, I see. Sorry about that! |
No worries, just wanted to let you know :) |
Rollup of 6 pull requests Successful merges: - rust-lang#85050 (Fix suggestions for missing return type lifetime specifiers) - rust-lang#85075 (Improve "panic message is not a string literal" warning) - rust-lang#85096 (Make unchecked_{add,sub,mul} inherent methods unstably const) - rust-lang#85112 (ensure failing promoteds in const/static bodies are handled correctly) - rust-lang#85146 (Provide io::Seek::rewind) - rust-lang#85147 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This pull request aims to fix #84592. The issue is that the current code seems to assume that there is only a single relevant span pointing to the missing lifetime, and only looks at the first one:
rust/compiler/rustc_resolve/src/late/lifetimes.rs
Line 2959 in e5f83d2
This is incorrect, though, and leads to incorrect error messages and invalid suggestions. For instance, the example from #84592:
currently leads to:
There are two problems:
With the changes in this PR, I get the following output:
Mainly, I changed
add_missing_lifetime_specifiers_label()
to receive a vector of spans (and counts) instead of just one, and adjusted its body accordingly.