-
-
Notifications
You must be signed in to change notification settings - Fork 15k
[confusing error message] iterate over str #46216
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Type
Fields
Give feedbackNo fields configured for issues without a type.
Given:
Rust produces (playground):
The suggestion says
iteror a similar method, but&strdoesn'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
strthat 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: