Skip to content

Commit 8adccdb

Browse files
authored
Merge pull request #4288 from rust-lang/rustup-2025-04-23
Automatic Rustup
2 parents 742d467 + 7ee4c95 commit 8adccdb

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fae7785b60ea7fe1ad293352c057a5b7be73d245
1+
1a5bf12f6586d724ed5ff40e58e06c0233560c0e

tests/pass/fn_align.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)