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
Use verbose suggestion for dyn
-less trait object lint
#76215
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @Aaron1011 |
@estebank: Personally, I prefer the less-verbose style. Was there a particular case that motiviated this change? |
@Aaron1011 my motivation was #61555. I find that in cases where we suggest adding or removing short tokens like |
@@ -2,9 +2,13 @@ warning: trait objects without an explicit `dyn` are deprecated | |||
--> $DIR/trait-bounds-not-on-bare-trait.rs:7:12 | |||
| | |||
LL | fn foo(_x: Foo + Send) { | |||
| ^^^^^^^^^^ help: use `dyn`: `dyn Foo + Send` | |||
| ^^^^^^^^^^ trait object without `dyn` |
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 the kind of case where I think the original output is better - we're pointing to the entire type, so having it inline seems just as clear.
It might be worth it to try to detect this case when constructing BuiltinLintDiagnostics::BareTraitObject
, and only use the verbose format when the target type is nested within another (e.g. &TraitName
or Box<TraitName>
).
@estebank: Sorry, I completely forgot about this PR. Personally, I'd prefer if we limited this to cases where the previous output is potentially confusing, as I described in my comment. However, I don't feel very strongly about this, so I'll leave it up to you to decide. |
Closing this based on #76215 (comment) and the fact that it has been inactive since then. |
No description provided.