diagnostics: do not suggest type name tweaks on type-inferred closure args by no...
source link: https://github.com/rust-lang/rust/pull/112325
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
Contributor
Fixes #111932
Collaborator
r? @eholk (rustbot has picked a reviewer for you, use r? to override) |
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
Collaborator
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
Does this need to be such a heavy hammer? It really looks like we should just not be applying suggestions to closure arguments that have no type span -- that seemed to me to be the real issue with #111932.
We can still keep suggestions for closure args that do, like |x: dyn Trait|
or whatever.
Or better yet, we apply them but make sure to apply them correctly...
fcx.require_type_is_sized( |
||
param_ty, |
||
param.pat.span, |
||
traits::SizedArgumentType(ty_span.filter(|_| !tcx.is_closure(fn_def_id.into()))), |
Can you make this into an if
like below? Easier to read that way IMO
Contributor
Author
It's complicated because Would you rather HIR be changed to make |
That's one way of doing it. If you don't want to do that much work though, you can check if the |
changed the title
diagnostics: do not suggest type name tweaks on closure args
diagnostics: do not suggest type name tweaks on type-inferred closure args
Contributor
Author
That makes sense. I've pushed a new commit that does that. |
r=me when green
This comment has been minimized.
Contributor
Author
@bors r=compiler-errors |
added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Successfully merging this pull request may close these issues.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK