Rollup merge of #138291 - jdonszelmann:optimize-attr, r=oli-obk

rewrite `optimize` attribute to use new attribute parsing infrastructure

r? ```@oli-obk```

I'm afraid we'll get quite a few of these PRs in the future. If we get a lot of trivial changes I'll start merging multiple into one PR. They should be easy to review :)

Waiting on #138165 first
This commit is contained in:
Trevor Gross
2025-06-20 02:50:37 -04:00
committed by GitHub
14 changed files with 74 additions and 60 deletions

View File

@@ -38,7 +38,8 @@ pub enum InstructionSetAttr {
ArmT32,
}
#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic, Default)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default, PrintAttribute)]
#[derive(Encodable, Decodable, HashStable_Generic)]
pub enum OptimizeAttr {
/// No `#[optimize(..)]` attribute
#[default]
@@ -229,7 +230,8 @@ pub enum AttributeKind {
/// Represents `#[rustc_macro_transparency]`.
MacroTransparency(Transparency),
/// Represents `#[optimize(size|speed)]`
Optimize(OptimizeAttr, Span),
/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
Repr(ThinVec<(ReprAttr, Span)>),