-
Notifications
You must be signed in to change notification settings - Fork 13k
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
suggestions: don't mention other impls of traits with type parameters #102752
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @lcnr (or someone else) soon. Please see the contribution instructions for more information. |
While I agree with the fact that listing basically every |
&mut err, | ||
) { | ||
// This is skipped for traits with type parameters | ||
// because those suggestions are noisy and unhelpful |
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.
// because those suggestions are noisy and unhelpful | |
// because those suggestions are noisy and unhelpful |
I agree with this, maybe we can collapse shown candidates from 8 to 6/5? |
My problem with them is that most of these recommendations are useless; not just that some are really noisy. I'd like it if suggestions such as these were not shown to users:
and these errors get exponentially worse as the traits get more complicated:
On the other hand, consider a variant of this diagnostic that is actually helpful (this PR keeps it, don't worry):
Even without reading the users code, you know what they did, why it doesn't work and how they can probably fix it. It is simple and helpful. If we aren't reasonably sure the suggestion is good, we should err on the side of not showing it - that is what this PR does. I'll admit to not really knowing what I'm doing - I barely know enough to be dangerous 😆 . If there's a better way to do what I'm trying to do I love to hear it 🙂 .
For many of these errors, that boils down to "this help is bad, so lets show less of it". I would much rather just not show it at all. It's hard for users to parse long error messages, especially if they're only sometimes helpful. |
I don't think that the thing that distinguishes "the following other types implement trait For example, I actually want a failed The issue here is twofold: (1.) Blanket impls are sometimes relevant, but also sometimes extraneous to mention. We don't take in account For example, I understand that Ideally, instead of suppressing this blanket impl, we could explain what Also, perhaps, we could first filter out trait implementations that either match the (2.) Some traits just have lots of (a.) filter out implementations that are "too far away" in type space from the implementor's input types, and... (b.) order (c.) sometimes there are just a combinatorial blow-up of So yeah, I understand this is a lot of extraneous information that you're stripping out of the ui test outputs right now, but I also feel like it's too heavy of a hammer, or at least currently a somewhat arbitrary heurustic you're using to decide when to skip these suggestions. If you want to do some more brainstorming, feel free to reach out. |
☔ The latest upstream changes (presumably #102867) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing this, I think we need to discuss this some more, for which i made #103822 |
These are almost always useless and they can take up a lot of space in error messages.