about summary refs log tree commit diff
path: root/compiler/rustc_attr_data_structures/src
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-06-20 02:50:37 -0400
committerGitHub <noreply@github.com>2025-06-20 02:50:37 -0400
commitbab4ca914ea58b5ced4903225fe31e90bfffed5f (patch)
treeccdfb8fadf2f53d28537a438042759dced12de4f /compiler/rustc_attr_data_structures/src
parent5b74275f89b6041bf2e9dc2abcf332e206d4cfca (diff)
parent3c418ec505233927d562ff906d8eea309aee1905 (diff)
downloadrust-bab4ca914ea58b5ced4903225fe31e90bfffed5f.tar.gz
rust-bab4ca914ea58b5ced4903225fe31e90bfffed5f.zip
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
Diffstat (limited to 'compiler/rustc_attr_data_structures/src')
-rw-r--r--compiler/rustc_attr_data_structures/src/attributes.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_attr_data_structures/src/attributes.rs b/compiler/rustc_attr_data_structures/src/attributes.rs
index cdc01dc6c91..65061059a02 100644
--- a/compiler/rustc_attr_data_structures/src/attributes.rs
+++ b/compiler/rustc_attr_data_structures/src/attributes.rs
@@ -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)>),