Closed
Description
Not sure if it is a bug or confusing error messages. Consider the following code:
Playground
#![feature(decl_macro)]
macro impl_mod($name:ident) {
pub mod $name {
pub struct Bar;
}
}
impl_mod!(foo);
use foo::Bar;
fn main() {}
Output:
error[E0432]: unresolved import `foo::Bar`
--> src/main.rs:11:5
|
11 | use foo::Bar;
| ^^^^^^^^ no `Bar` in `foo`. Did you mean to use `Bar`?
warning: unused import: `foo::Bar`
--> src/main.rs:11:5
|
11 | use foo::Bar;
| ^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
What is confusing:
- So is it unresolved or resolved and unused?
- "no 'Bar'. did you mean 'Bar'?" - feels like a bug.
- Path
foo
is accessible, why thenfoo::Bar
not?
rustc --version --verbose
:
rustc 1.24.0-nightly (560a5da9f 2017-11-27)
binary: rustc
commit-hash: 560a5da9f1cc7f67d2fc372925aef18c96c82629
commit-date: 2017-11-27
host: x86_64-unknown-linux-gnu
release: 1.24.0-nightly
LLVM version: 4.0