Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #151382 - JonathanBrouwer:attr-perf, r=jdonszelmann
Only run finalizers of accepted attributes
Locally this had insanely good perf, but lets see what reality thinks about this
r? @jdonszelmann
Attribute parsing consists of two stages:
- All attribute are "accepted" by one or more parsers, which means the unparsed attribute is parsed, information about it is stored in the attr parser struct
- After all attributes are parsed, we "finalize" all parsers, producing a single parsed attribute representation from the parser struct.
This two-stage process exist so multiple attributes can get merged into one parser representation. For example if you have two repr attributes `#[repr(C)]` `#[repr(packed)]` it will only produce one parsed `Repr` attribue.
The dumb thing we did was we would "finalize" all parsers, even the ones that never accepted an attribute. This PR only calls finalize on the parsers that accepted at least one attribute.