Some more sleuthing:
-
RFC 1561 (macro naming and modularization) seems to suggest that
use
should work on declarative macros 2.0. - Talk in the tracking issue also seems to take this as a given. I.e. it is only
macro_rules!
macros that should get the short end of the stick. - The “roadmap” for that issue has every box ticked with no explicit mention of decl macros 2.0.
- declarative macros 2.0 still has no documentation
Baaaahhhhhh, you know what? Documentation or no documentation, I’m just going to copy the first thing I see on the tracking issue, tweak it until it compiles, and see what happens:
#![feature(decl_macro)]
fn main() {
println!("{}", m::m_helper!());
}
mod m {
pub macro m_helper() {
3
}
}
Output:
3
Whew! So there you have it. Contrary to what I previously said, it appears that use
-able, locally-defined macros are not only planned, but they are already implemented (at least partially). However, it is only for declarative macros 2.0 (macro
, not macro_rules!
)