-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[confusing error message] iterate over str #46216
Comments
Sounds like an extension of the very controversial methods suggestion. But why not? If other people agree on it, I can add it. |
(Given that |
The message comes from |
I would like such a message |
…nikomatsakis Add filtering options to `rustc_on_unimplemented` - Add filtering options to `rustc_on_unimplemented` for local traits, filtering on `Self` and type arguments. - Add a way to provide custom notes. - Tweak binops text. - Add filter to detect wether `Self` is local or belongs to another crate. - Add filter to `Iterator` diagnostic for `&str`. Partly addresses rust-lang#44755 with a different syntax, as a first approach. Fixes rust-lang#46216, fixes rust-lang#37522, CC rust-lang#34297, rust-lang#46806.
|
Given:
Rust produces (playground):
The suggestion says
iter
or a similar method, but&str
doesn't have an.iter()
method (that's why it says "or a similar method").I don't think this is good enough.
It should scan the methods of
str
that return something that implementsIterator
(or can be auto-deref to something that implements it) and suggest those. In this case,chars()
,bytes()
,... The error message should look more like this:The text was updated successfully, but these errors were encountered: