Skip to content

Commit f554c79

Browse files
committed
Do not give function allocations alignment in consteval or miri.
1 parent 3fb1b53 commit f554c79

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

compiler/rustc_const_eval/src/interpret/memory.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
937937
// (both global from `alloc_map` and local from `extra_fn_ptr_map`)
938938
if let Some(fn_val) = self.get_fn_alloc(id) {
939939
let align = match fn_val {
940-
FnVal::Instance(instance) => {
941-
self.tcx.codegen_instance_attrs(instance.def).alignment.unwrap_or(Align::ONE)
940+
FnVal::Instance(_instance) => {
941+
// FIXME: Until we have a clear design for the effects of align(N) functions
942+
// on the address of function pointers, we don't consider the align(N)
943+
// attribute on functions in the interpreter.
944+
//self.tcx.codegen_instance_attrs(instance.def).alignment.unwrap_or(Align::ONE)
945+
Align::ONE
942946
}
943947
// Machine-specific extra functions currently do not support alignment restrictions.
944948
FnVal::Other(_) => Align::ONE,

src/tools/miri/tests/pass/fn_align.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)