about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-06-18 20:22:49 -0400
committerGitHub <noreply@github.com>2025-06-18 20:22:49 -0400
commit07932ad11153b62ec2138fa71a398a1ca8ea05ac (patch)
tree289f0c510ce9d472d6c5e29424f3174fe7ac71b9 /compiler/rustc_codegen_ssa/src
parentcff8e9ae142c3dcaf4c66ec5b6be932f1442c4b5 (diff)
parent1fdf2b562070ec98c5b32ee67b8c6d8145127a6e (diff)
downloadrust-07932ad11153b62ec2138fa71a398a1ca8ea05ac.tar.gz
rust-07932ad11153b62ec2138fa71a398a1ca8ea05ac.zip
Rollup merge of #142507 - folkertdev:fn-align-align-attribute, r=jdonszelmann
use `#[align]` attribute for `fn_align`

Tracking issue: https://github.com/rust-lang/rust/issues/82232

https://github.com/rust-lang/rfcs/pull/3806 decides to add the `#[align]` attribute for alignment of various items. Right now it's used for functions with `fn_align`, in the future it will get more uses (statics, struct fields, etc.)

(the RFC finishes FCP today)

r? `@ghost`
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/codegen_attrs.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
index 188a9a98ce7..98742255063 100644
--- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
+++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
@@ -3,7 +3,6 @@ use std::str::FromStr;
 use rustc_abi::ExternAbi;
 use rustc_ast::expand::autodiff_attrs::{AutoDiffAttrs, DiffActivity, DiffMode};
 use rustc_ast::{LitKind, MetaItem, MetaItemInner, attr};
-use rustc_attr_data_structures::ReprAttr::ReprAlign;
 use rustc_attr_data_structures::{
     AttributeKind, InlineAttr, InstructionSetAttr, OptimizeAttr, find_attr,
 };
@@ -110,17 +109,8 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
             }
         };
 
-        if let hir::Attribute::Parsed(p) = attr {
-            match p {
-                AttributeKind::Repr(reprs) => {
-                    codegen_fn_attrs.alignment = reprs
-                        .iter()
-                        .filter_map(|(r, _)| if let ReprAlign(x) = r { Some(*x) } else { None })
-                        .max();
-                }
-
-                _ => {}
-            }
+        if let hir::Attribute::Parsed(AttributeKind::Align { align, .. }) = attr {
+            codegen_fn_attrs.alignment = Some(*align);
         }
 
         let Some(Ident { name, .. }) = attr.ident() else {