Create an Item from an inner attribute
Yamakaky opened this issue · 7 comments
My goal is to have an attribute #![allow(non_camel_case_types)]
in a generated Mod. I tried to use ExtCtxt::item
, but it requires a ItemKind
, and non of it's variants correspond. Is it a bug?
Inner attributes are just attributes on the mod (they are not items). If you generated the mod you can attach attributes yourself.
I'm not quite sure what the larger situation here is.
I work on bindgen https://github.com/crabtw/rust-bindgen/blob/master/src/gen.rs#L179.
Mod only contains Items and a span
Where are you creating the Mod
itself? Inner attributes are a field on the Mod
, not contents.
The mod itself is an item, you need to generate an Item
with an ItemKind::Mod
with attribute on it
(closing, this isn't related to syntex, you may want to ask further questions on #rust-internals on Mozilla IRC)
Ok, sorry.