Skip to content

did you mean tar? suggestion without any explanation where tar is from #53445

Closed
@oli-obk

Description

@oli-obk

On the playground (which has the tar crate available (or maybe this is rustc in general?))

fn main() {
    bar()
}

(Playground)

Errors:

   Compiling playground v0.0.1 (file:///playground)
error[E0425]: cannot find function `bar` in this scope
 --> src/main.rs:2:5
  |
2 |     bar()
  |     ^^^ did you mean `tar`?

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Following the suggestion gives

error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
 --> src/main.rs:2:5
  |
2 |     tar()
  |     ^^^

error[E0423]: expected function, found module `tar`
 --> src/main.rs:2:5
  |
2 |     tar()
  |     ^^^ not a function

I think we should be adding a note to the "did you mean" mentioning the kind of item, so "did you mean module tar?"

Also it looks to me like this is not a structured suggestion, we should make it one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions