Skip to content

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

Closed
@matthiaskrgr

Description

@matthiaskrgr
Member

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?

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Nov 10, 2021
self-assigned this
on Nov 11, 2021
added 2 commits that reference this issue on Nov 16, 2021

Rollup merge of rust-lang#90803 - TaKO8Ki:suggest-chars-on-attempt-to…

5f7d30f

Rollup merge of rust-lang#90803 - TaKO8Ki:suggest-chars-on-attempt-to…

b17de50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Participants

    @matthiaskrgr@TaKO8Ki

    Issue actions

      suggest &str.chars() on attempt to &str.iter() · Issue #90786 · rust-lang/rust