Closed

Description
Importing names sometimes requires use self::
as shown here:
main.rs
use foo::Foo;
mod foo;
fn main() {}
foo.rs
use bar::Bar; //looks fine at first glance but is actually an error
mod bar;
pub struct Foo {
bar: Bar
}
bar.rs
pub struct Bar;
Someone new to Rust will almost certainly make this mistake, and then see the following error message:
foo.rs:1:5: 1:8 error: unresolved import. maybe a missing `extern crate bar`?
foo.rs:1 use bar::Bar;
^~~
foo.rs:1:5: 1:13 error: failed to resolve import `bar::Bar`
foo.rs:1 use bar::Bar;
^~~~~~~~
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. when mod bar;
cannot be resolved).
There should be a hint to maybe use self::
when use bar::Bar;
cannot be resolved and the current module is not the crate root.