Suggest importing macros from crate roots #59764
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
Consider a directory for a crate
mycrate
:foo.rs
declares amacro_rules! makro
macro and#[macro_export]
s it.In a separate crate, a user writes:
This is because
#[macro_export]
exports the macro in the crate root rather than the module in which it is defined.It's very difficult to debug this if you're not aware of this behaviour. It would be really helpful to have a suggestion to replace the suggestion with
use mycrate::makro;
, or have a message saying thatmakro
exists inmycrate
(ideally with some background information describing the problem).The text was updated successfully, but these errors were encountered: