Expand description
Resolve cfg / cfg_attr on the members of a #[miniextendr] item before
anything is generated from it.
An attribute macro receives its item unconfigured: rustc has not evaluated the gates on the itemโs methods, trait items, parameters, variants or fields. Forwarding a memberโs gate to some generated items is not enough, because item-wide analysis (constructor inference, S7 properties, name collisions, factor levels, R formals) and the generated R text must see the same members the compiled item has. So the macro re-enters itself on two gated copies of the item, one per value of the first member gate it finds. rustc strips the inactive copy before expanding it, so each pass resolves one gate and configurations are never enumerated. The item stays whole: splitting an impl into separately registered blocks would change constructor inference and the ownership of S7 properties.
Gates on the item itself need no re-entry: rustc evaluates them when they
precede #[miniextendr], and the expansion forwards them otherwise.
Functionsยง
- member_
attrs ๐ - member_
attrs_ ๐mut - Only called for a member
member_attrsreturned. - member_
count ๐ - Number of gateable members: function parameters, impl and trait items, enum variants, struct fields.
- remove_
at ๐ - remove_
member ๐ - select ๐
- Re-enter
#[miniextendr(attr)]on both resolutions of the itemโs first member gate, or returnNonewhen no member carries one.