Open
Description
All attributes, both using the old and new parsing infrastructure are currently parsed (at least) twice
- To do a few checks on the attribute, here: https://github.com/rust-lang/rust/blob/cccf075eba88363269e8589ebb8d40874cc542d8/compiler/rustc_parse/src/validate_attr.rs#L34C19-L34C29
- To lower the attribute, here:
#[cfg]
was one of the only attributes that was only parsed once. When we ported #[cfg] the the new parsing infrastructure (#143460), we sadly had to also parse it twice, losing around ~0.2% performance on some benchmarks.
This suggests that if we can merge these checks into the new attribute parser we can gain quite a bit of performance. We should do this.