-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Convert a hard-warning about named static lifetimes into a lint #98079
Conversation
This lint will replace the existing hard-warning.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
Perhaps a |
compiler/rustc_resolve/Cargo.toml
Outdated
@@ -21,6 +21,7 @@ rustc_expand = { path = "../rustc_expand" } | |||
rustc_feature = { path = "../rustc_feature" } | |||
rustc_hir = { path = "../rustc_hir" } | |||
rustc_index = { path = "../rustc_index" } | |||
rustc_lint_defs = { path = "../rustc_lint_defs" } |
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.
rustc_resolve
typically uses lints through rustc_session::lint
, so adding this shouldn't be necessary.
I agree that this is a very niche case, but I hesitate to lump this together with |
@jeremydavis519 I think @petrochenkov's proposal is to reuse the unused lifetimes name for the lint so that these two are effectively a "family" of errors in the same lint, the user visible output would have the same amount of context as it does today so people wouldn't be confused about what they should do. It would remove some granularity on allowing one and not the other, but that should be... rare. |
let help = &format!( | ||
"you can use the `'static` lifetime directly, in place of `{}`", | ||
lifetime.name.ident(), | ||
); | ||
lint.build(msg) | ||
.help(help) |
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.
Not necessarily something to do on this PR, but we have enough context to turn the help
into a structured suggestion, by inspecting the bounds and suggesting:
LL - type Y<'a: 'static>;
LL + type Y<'static>;
| ~~~~~~~
Alright, I don't mind grouping the lints together. My main concern is that I would be mildly confused if I saw |
What's the status here? I'll switch to waiting on author since I think there are pending comments. Feel free to update the status of this PR with @rustbot author |
☔ The latest upstream changes (presumably #97313) made this pull request unmergeable. Please resolve the merge conflicts. |
@jeremydavis519 what's the timeline on moving forward with the proposal? I'd be happy to address feedback |
@estebank PR contributor hasn't been active in this PR for over 2 months, is there a process for taking over the feature ask? |
@mkatychev you can pull from @jeremydavis519's branch, build upon it and publish a new PR referencing this one. |
@jeremydavis519 @rustbot label: +S-inactive |
…bank Convert a hard-warning about named static lifetimes into lint "unused_lifetimes" Fixes rust-lang#96956. Some changes are ported from rust-lang#98079, thanks to jeremydavis519. r? `@estebank` `@petrochenkov` Any feedback is appreciated! ## Actions - [x] resolve conflicts - [x] fix build - [x] address review comments in last pr - [x] update tests
…bank Convert a hard-warning about named static lifetimes into lint "unused_lifetimes" Fixes rust-lang#96956. Some changes are ported from rust-lang#98079, thanks to jeremydavis519. r? `@estebank` `@petrochenkov` Any feedback is appreciated! ## Actions - [x] resolve conflicts - [x] fix build - [x] address review comments in last pr - [x] update tests
Fixes #96956.
This change is pretty simple, but any feedback is appreciated.
Thanks to cjgillot for the clear instructions in the issue's thread. They made this so much easier. :)