I’ve defined a macro in a crate, and that macro uses
lazy_static internally. Unfortunately, when I use this macro from another crate, I get the error “cannot find macro
lazy_static! in this scope.”
This is finally fixed when I do
#[macro_use] extern crate lazy_static in the crate in which I’m using the macro, but this seems sketchy to me for two reasons:
- This requires the user to know about this dependency
- I could probably instead do
#[macro_use] extern crate lazy_staticin the macro definition itself, but then that would preclude the macro from being used anywhere other than a crate root (since doing
extern cratedeclaration is disallowed outside of the crate root).
Is there a clean way around this issue that I’m missing?