Skip to content

suggest &str.chars() on attempt to &str.iter() #90786

Closed
@matthiaskrgr

Description

@matthiaskrgr

Given the following code:

pub fn main() {
let _ = "hello world".iter();
}

The current output is:

error[E0599]: no method named `iter` found for reference `&'static str` in the current scope
 --> src/main.rs:2:23
  |
2 | let _ = "hello world".iter();
  |                       ^^^^ method not found in `&'static str`

For more information about this error, try `rustc --explain E0599`.

Ideally the output should look like:

maybe add a "did you mean .chars()?" suggestion and underline the .iter() or something?

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions