diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-03 01:02:43 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-05-03 08:05:27 +0530 |
| commit | 1d6cc191fc65784dc533cfd3a59262cd8c299e3c (patch) | |
| tree | eb5e1d40971ff91897fa110562475dd8aeaff474 | |
| parent | 308f10cdf5d1ddc8824e179d74951a7bd90b9476 (diff) | |
| parent | d20b4067fd0e1b641b0c126bd69461b09171519e (diff) | |
Rollup merge of #33320 - birkenfeld:issue31573, r=arielb1
diagnostics for E0432: imports are relative to crate root This is curiously missing from both the short message and this long diagnostic. Refs #31573 (not sure if it should be considered "fixed" as the short message still only refers to extern crates).
| -rw-r--r-- | src/librustc_resolve/diagnostics.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 0a8fce49ebb..56d3b927dc5 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -916,11 +916,14 @@ 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; @@ -928,7 +931,7 @@ mod something { ``` 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 |
