Skip to content

Commit

Permalink
diagnostics for E0432: imports are relative to crate root
Browse files Browse the repository at this point in the history
This is curiously missing from both the short message and this
long diagnostic.

Refs rust-lang#31573 (not sure if it should be considered "fixed" as the
short message still only refers to extern crates).
  • Loading branch information
birkenfeld committed May 2, 2016
1 parent 2a815a2 commit d20b406
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,19 +916,22 @@ An import was unresolved. Erroneous code example:
use something::Foo; // error: unresolved import `something::Foo`.
```
Please verify you didn't misspell the import name or the import does exist
in the module from where you tried to import it. Example:
Paths in `use` statements are relative to the crate root. To import items
relative to the current and parent modules, use the `self::` and `super::`
prefixes, respectively. Also verify that you didn't misspell the import
name and that the import exists in the module from where you tried to
import it. Example:
```ignore
use something::Foo; // ok!
use self::something::Foo; // ok!
mod something {
pub struct Foo;
}
```
Or, if you tried to use a module from an external crate, you may have missed
the `extern crate` declaration:
the `extern crate` declaration (which is usually placed in the crate root):
```ignore
extern crate homura; // Required to use the `homura` crate
Expand Down

0 comments on commit d20b406

Please sign in to comment.