Skip to content

Commit 76feb1f

Browse files
authored
Rollup merge of #142507 - folkertdev:fn-align-align-attribute, r=jdonszelmann
use `#[align]` attribute for `fn_align` Tracking issue: rust-lang/rust#82232 rust-lang/rfcs#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`
2 parents eb39067 + cab5bd2 commit 76feb1f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/pass/fn_align.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
//@compile-flags: -Zmin-function-alignment=8
22
#![feature(fn_align)]
33

4-
// When a function uses `repr(align(N))`, the function address should be a multiple of `N`.
4+
// When a function uses `align(N)`, the function address should be a multiple of `N`.
55

6-
#[repr(align(256))]
6+
#[align(256)]
77
fn foo() {}
88

9-
#[repr(align(16))]
9+
#[align(16)]
1010
fn bar() {}
1111

12-
#[repr(align(4))]
12+
#[align(4)]
1313
fn baz() {}
1414

1515
fn main() {
1616
assert!((foo as usize).is_multiple_of(256));
1717
assert!((bar as usize).is_multiple_of(16));
1818

19-
// The maximum of `repr(align(N))` and `-Zmin-function-alignment=N` is used.
19+
// The maximum of `align(N)` and `-Zmin-function-alignment=N` is used.
2020
assert!((baz as usize).is_multiple_of(8));
2121
}

0 commit comments

Comments
 (0)