Do not give function allocations alignment in consteval or miri.

This commit is contained in:
Zachary S 2025-07-30 15:35:19 -05:00
parent 3fb1b53a9d
commit f554c79ef8
2 changed files with 6 additions and 27 deletions

View file

@ -1,25 +0,0 @@
//@compile-flags: -Zmin-function-alignment=8
// FIXME(rust-lang/rust#82232, rust-lang/rust#143834): temporarily renamed to mitigate `#[align]`
// nameres ambiguity
#![feature(rustc_attrs)]
#![feature(fn_align)]
// When a function uses `align(N)`, the function address should be a multiple of `N`.
#[rustc_align(256)]
fn foo() {}
#[rustc_align(16)]
fn bar() {}
#[rustc_align(4)]
fn baz() {}
fn main() {
assert!((foo as usize).is_multiple_of(256));
assert!((bar as usize).is_multiple_of(16));
// The maximum of `align(N)` and `-Zmin-function-alignment=N` is used.
assert!((baz as usize).is_multiple_of(8));
}