We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 792e379 + b69d044 commit 7ee4c95Copy full SHA for 7ee4c95
tests/pass/fn_align.rs
@@ -0,0 +1,21 @@
1
+//@compile-flags: -Zmin-function-alignment=8
2
+#![feature(fn_align)]
3
+
4
+// When a function uses `repr(align(N))`, the function address should be a multiple of `N`.
5
6
+#[repr(align(256))]
7
+fn foo() {}
8
9
+#[repr(align(16))]
10
+fn bar() {}
11
12
+#[repr(align(4))]
13
+fn baz() {}
14
15
+fn main() {
16
+ assert!((foo as usize).is_multiple_of(256));
17
+ assert!((bar as usize).is_multiple_of(16));
18
19
+ // The maximum of `repr(align(N))` and `-Zmin-function-alignment=N` is used.
20
+ assert!((baz as usize).is_multiple_of(8));
21
+}
0 commit comments