- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints

Description
This problem occurs with the new path rules in edition 2018. If the crate keyword from a uses import is missing, the current error message is not very helpful. For example:
mod bla {
    pub struct Bla;
}
use bla::Bla;returns on stable, beta and nightly the following error message:
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
 --> src/main.rs:9:5
  |
5 | / mod bla {
6 | |     pub struct Bla;
7 | | }
  | |_- not an extern crate passed with `--extern`
8 | 
9 |   use bla::Bla;
  |       ^^^
  |
note: this import refers to the module defined here
 --> src/main.rs:5:1
  |
5 | / mod bla {
6 | |     pub struct Bla;
7 | | }
  | |_^
warning: unused import: `bla::Bla`
 --> src/main.rs:9:5
  |
9 | use bla::Bla;
  |     ^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default
The compiler looks for a crate bla but doesn't find one, therefore the error message. I'm not sure, how this relates to the upcoming decision regarding the efforts for path clarity. But I stumbled over this several times now, out of habit...
(If this issue is accepted, I would like to improve it :) I would probably need mentoring though.)
MatthieuBizien, pscherz and jens1o
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
