Weird error message for missing symbol if module name is the same as a macro
d354510
Opened by Tobias Bucher at
mod format {
mod sub {
pub fn foobar() { }
}
}
fn main() {
format::foobar();
}
$ rustc a.rs
error[E0423]: expected function, found macro `format::foobar`
--> a.rs:8:5
|
8 | format::foobar();
| ^^^^^^^^^^^^^^ did you mean `format::foobar!(...)`?
|
= help: possible better candidate is found in another module, you can import it into scope:
`use format::sub::foobar;`
error: aborting due to previous error
$ rustc --version
rustc 1.17.0-nightly (134c4a0f0 2017-03-20)
The weird thing is "expected function, found macro". format::foobar doesn't look like a macro. This also happens without the submodule sub (i.e. with an empty module format), the only difference is that no other candidate is suggested.
I got a similar error with this code:
mod file { } fn main() { file::create(); }The error is:
error[E0423]: expected function, found macro `file::create` --> src/main.rs:5:5 | 5 | file::create(); | ^^^^^^^^^^^^ did you mean `file::create!(...)`?antoyo at 2018-01-17 16:13:27