Skip to content

Fix/clarify inert/active attributes, and attribute sequence. #565

Open

Description

The inert/active attribute description is not be correct. The following comment needs to be incorporated: #537 (review)

However, I think the inert/active distinction is subtle and should have more clarification. It is possible to "see" an active attribute based on the point in time during compilation (for example, an attribute macro placed before #[test] sees the test attribute, it has not been removed, yet).

Also, to me it seems like like cfg and cfg_attr aren't always active. If the predicate is true, they are clearly visible from attribute macros, so they have not been removed. This comment implies that things are broken.

I would like to know how I can validate this inert/active distinction by reading the rustc code. It is not tracked in any data structure I can see, and I do not know through which mechanism an attribute removes itself. Otherwise I feel like I am shooting in the dark trying to document this.

Also I think the order that attributes are processed and when attributes remove themselves should be documented. For example, do attribute macros see derive macros (yes, the derive has not been removed, yet). What is the significance of the order that attributes are listed? (Presumably they are processed top-down?) Attribute macros seem to be removed only after they are processed (an attribute macro sees the attributes below it, but not above it). When is cfg pruning done (pretty early)? In general I think the order attributes are processed and when attributes remove themselves should be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions