Closed
Description
Given the following code: link
trait Trait {}
mod a {
use Trait;
}
fn main() {}
The current output is:
Compiling playground v0.0.1 (/playground)
error[[E0432]](https://doc.rust-lang.org/nightly/error-index.html#E0432): unresolved import `Trait`
--> src/main.rs:4:9
|
4 | use Trait;
| ^^^^^ no external crate `Trait`
For more information about this error, try `rustc --explain E0432`.
error: could not compile `playground` due to previous error
Ideally the output can look something like this:
Compiling playground v0.0.1 (/playground)
error[[E0432]](https://doc.rust-lang.org/nightly/error-index.html#E0432): unresolved import `Trait`
--> src/main.rs:4:9
|
4 | use Trait;
| ^^^^^ no external crate `Trait`
|
help: add `crate::` to import trait `Trait`
|
4 | use crate::Trait;
| +++++++
For more information about this error, try `rustc --explain E0432`.
error: could not compile `playground` due to previous error
This can also be extended to other items such as functions and variables. The help should only be emitted if an exact match exist in the parent scope and the scope resolution used is incorrect. Thanks.