Skip to content

Uniformative error message when missing a "self" while importing a module #31573

Description

@julienw

Exemple code:

mod foo {
  mod hello {
    pub enum world {}
  }
  use hello::world;
}

fn main() {
}

Error is:

<anon>:6:7: 6:12 error: unresolved import `hello::world`. Maybe a missing `extern crate hello`? [E0432]
<anon>:6   use hello::world;
               ^~~~~
<anon>:6:7: 6:12 help: see the detailed explanation for E0432
error: aborting due to previous error
playpen: application terminated with error code 101

The compiler should detect that "self" is missing.

Note this is an error I do all the time as a beginner.

Activity

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

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