Two macro scoping questions
⚓ Rust 📅 2025-09-23 👤 surdeus 👁️ 9Don't worry, they're the easy kind, nothing to do with hygiene...
-
The standard library has a handful of macros you can't import from the crate root. The ones I know are
std::pin::pin!andstd::mem::offset_of!. User crates can't do that in stable Rust, right? -
It seems like
#[macro_use]and#[macro_export]and the above restriction could all be forgotten if Rust allowedpubonmacro_rules!macros. (I'm imagining it would cause the macro to have path-based scope.) Is there some reason that wouldn't work?
4 posts - 3 participants
🏷️ Rust_feed