-
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
Account for HR lifetimes when suggesting introduction of named lifetime #68583
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
cc @rust-lang/compiler I know we removed some lifetime-related automatic suggestions, are these related? Also, do people have opinions on what we should be showing? |
cc @rust-lang/wg-diagnostics as well. |
This comment has been minimized.
This comment has been minimized.
@@ -9,12 +9,24 @@ error[E0261]: use of undeclared lifetime name `'a` | |||
| | |||
LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); | |||
| ^^ undeclared lifetime | |||
| | |||
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html |
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.
btw, can this note be moved to after the help:
? The blog post analogy to this would be having the "read more" link before the introduction.
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.
This is part of a separate bug where all suggestions come always at the end. I would rather tackle that in a separate PR, ideally after fully migrating to annotate_snippets.
r? @rust-lang/wg-diagnostics |
Would you mind to r? @oli-obk |
@bors r+ |
📌 Commit 4310b74 has been approved by |
Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors retry |
⌛ Testing commit 4310b74 with merge b4097ad7cc9693bf7845908726213028ead63854... |
Failed in #68852 (comment), @bors r- retry |
Rebased and fixed test. @bors r=oli-obk |
📌 Commit 609a374 has been approved by |
Account for HR lifetimes when suggesting introduction of named lifetime ``` error[E0106]: missing lifetime specifier --> src/test/ui/suggestions/fn-missing-lifetime-in-item.rs:2:32 | 2 | struct S2<F: Fn(&i32, &i32) -> &i32>(F); | ---- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html help: consider making the bound lifetime-generic with a new `'a` lifetime | 2 | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F); | ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^ help: consider introducing a named lifetime parameter | 2 | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);= | ^^^ ^^^^^^^ ^^^^^^^ ^^^ ``` Follow up to #68267. Addresses the diagnostics part of #49287.
☀️ Test successful - checks-azure |
Follow up to #68267. Addresses the diagnostics part of #49287.