Closed
Description
Consider a directory for a crate mycrate
:
src
- lib.rs
- foo.rs
foo.rs
declares a macro_rules! makro
macro and #[macro_export]
s it.
In a separate crate, a user writes:
use mycrate::foo::makro; // error: cannot find macro `makro!` in this scope
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 that makro
exists in mycrate
(ideally with some background information describing the problem).