Better "unresolved import" error message and "self::" #13577
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-resolve
Area: Name/path resolution done by `rustc_resolve` specifically
Importing names sometimes requires
use self::
as shown here:main.rs
foo.rs
bar.rs
Someone new to Rust will almost certainly make this mistake, and then see the following error message:
Personally I found this was the main source of frustration while learning Rust's module system because of my ingrained thinking in absolute paths.
I think two changes would be helpful here:
The
maybe a missing extern crate bar
hint should only be given when appropriate (ie. whenmod bar;
cannot be resolved).There should be a hint to maybe use
self::
whenuse bar::Bar;
cannot be resolved and the current module is not the crate root.The text was updated successfully, but these errors were encountered: