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 742d467 + 7ee4c95 commit 8adccdbCopy full SHA for 8adccdb
rust-version
@@ -1 +1 @@
1
-fae7785b60ea7fe1ad293352c057a5b7be73d245
+1a5bf12f6586d724ed5ff40e58e06c0233560c0e
tests/pass/fn_align.rs
@@ -0,0 +1,21 @@
+//@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