-
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
diagnostics: do not suggest type name tweaks on type-inferred closure args #112325
Conversation
r? @eholk (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
121527b
to
2e9d957
Compare
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
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.
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()))), |
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.
Can you make this into an if
like below? Easier to read that way IMO
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 |
2e9d957
to
33bdca1
Compare
That makes sense. I've pushed a new commit that does that. |
33bdca1
to
3a2e4f7
Compare
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.
r=me when green
This comment has been minimized.
This comment has been minimized.
4379f7e
to
8f06fbc
Compare
8f06fbc
to
467bc9f
Compare
@bors r=compiler-errors |
…r=compiler-errors diagnostics: do not suggest type name tweaks on type-inferred closure args Fixes rust-lang#111932
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#111058 (Correct fortanix LVI test print function) - rust-lang#111369 (Added custom risc32-imac for esp-espidf target) - rust-lang#111962 (Make GDB Python Pretty Printers loadable after spawning GDB, avoiding required `rust-gdb`) - rust-lang#112019 (Don't suggest changing `&self` and `&mut self` in function signature to be mutable when taking `&mut self` in closure) - rust-lang#112199 (Fix suggestion for matching struct with `..` on both ends) - rust-lang#112220 (Cleanup some `EarlyBinder::skip_binder()` -> `EarlyBinder::subst_identity()`) - rust-lang#112325 (diagnostics: do not suggest type name tweaks on type-inferred closure args) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #111932