Skip to content

Commit cab5bd2

Browse files
committed
add #[align] attribute
Right now it's used for functions with `fn_align`, in the future it will get more uses (statics, struct fields, etc.)
1 parent 031e1ce commit cab5bd2

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)