Closed
Description
If a crate or module defines a macro with the same name as the crate or module, any type error suggests that you invoke a non-existent macro instead of what you meant to write.
mod syn {
#[allow(unused_macros)]
macro_rules! syn {
() => {}
}
}
fn main() {
let _: syn::Foo;
}
error[E0573]: expected type, found macro `syn::Foo`
--> src/main.rs:22:9
|
22 | let _: syn::Foo;
| ^^^^^^^^ did you mean `syn::Foo!(...)`?
If the macro name is different from the module name then the error is reasonable.
error[E0412]: cannot find type `Foo` in module `syn`
--> src/main.rs:22:14
|
22 | let _: syn::Foo;
| ^^^ not found in `syn`
This currently affects the Syn crate. @Arnavion
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: Name/path resolution done by `rustc_resolve` specificallyCategory: An issue proposing an enhancement or a PR with one.Relevant to the language team, which will review and decide on the PR/issue.