Skip to content

Reduce the size of check_attrs.rs and move as much as possible into the attribute parsers. #153101

@JayanAXHF

Description

@JayanAXHF

As part of the attribute parser rework initiative, i'd be nice to reduce the size of check_attrs.rs and move as much of the code into the attribute parsers themselves. This is part of #131229.

Mentor: @JonathanBrouwer

There is quite a lot of different checks in check_attrs.rs, and the goal is to move as much as possible to the respective attribute parsers. A lot of things are not currently moveable because the right information is not available in the attribute parsers, and making this information available is difficult

All checks:

Legend:

  1. Requires detailed target information: Requires a way for the target checking to know more about the target than currently available to the attribute parsers. Ideally, we should pass information from either the AST or the HIR down, not sure which is easier.
  2. Requires other attrs: These checks check the presence or absence of other attributes. We need to find a nice way to represent this. (claimed by @rperier)
  3. The allowed targets depend on the arguments passed to the attribute, we need to find a way to allow target checking to depend on arguments

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ASTArea: ASTA-attributesArea: Attributes (`#[…]`, `#![…]`)C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-help-wantedCall for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.E-tediousCall for participation: An issue involves lots of work and is better handled as many small tasks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    No fields configured for Cleanup.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions