-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
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
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team