Closed
Description
I'm trying to switch a few of the libstd macros from generated module to multi item macros, and I've run in a few issues:
Import lines are not supported:
#[feature(macro_rules)];
macro_rules! items(
() => (
use std::option::Option;
)
)
items!()
multi_item_macro_bugs.rs:5:31: 5:32 error: view items are not allowed here
multi_item_macro_bugs.rs:5 use std::option::Option;
^
Inner attributes are not supported:
#[feature(macro_rules)];
macro_rules! items(
() => (
#[feature(globs)];
)
)
items!()
multi_item_macro_bugs.rs:5:25: 5:26 error: macro expansion ignores token `;` and any following
multi_item_macro_bugs.rs:5 #[feature(globs)];
^
I'm not sure if those two are intentional limitations or not, but if they are, then not all use cases for macros-expanding-to-generated-modules can be replaced with item macros. (See std::num::uint_macros
for a big example)