Skip to content

Commit 655a519

Browse files
authored
Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ralfjung,traviscross
Implement `#[rustc_align_static(N)]` on `static`s Tracking issue: rust-lang/rust#146177 ```rust #![feature(static_align)] #[rustc_align_static(64)] static SO_ALIGNED: u64 = 0; ``` We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`. r? `@traviscross`
2 parents a211d63 + 2d2aad3 commit 655a519

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/consts.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
8181
if global.to_rvalue().get_type() != val_llty {
8282
global.to_rvalue().set_type(val_llty);
8383
}
84+
85+
// NOTE: Alignment from attributes has already been applied to the allocation.
8486
set_global_alignment(self, global, alloc.align);
8587

8688
global.global_set_initializer_rvalue(value);

0 commit comments

Comments
 (0)