From f554c79ef819cbc0f9983d0d5306cd7a9bfea6d8 Mon Sep 17 00:00:00 2001 From: Zachary S Date: Wed, 30 Jul 2025 15:35:19 -0500 Subject: Do not give function allocations alignment in consteval or miri. --- compiler/rustc_const_eval/src/interpret/memory.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_const_eval/src/interpret/memory.rs') diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 47bebf5371a..bbde7c66acc 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -937,8 +937,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // (both global from `alloc_map` and local from `extra_fn_ptr_map`) if let Some(fn_val) = self.get_fn_alloc(id) { let align = match fn_val { - FnVal::Instance(instance) => { - self.tcx.codegen_instance_attrs(instance.def).alignment.unwrap_or(Align::ONE) + FnVal::Instance(_instance) => { + // FIXME: Until we have a clear design for the effects of align(N) functions + // on the address of function pointers, we don't consider the align(N) + // attribute on functions in the interpreter. + //self.tcx.codegen_instance_attrs(instance.def).alignment.unwrap_or(Align::ONE) + Align::ONE } // Machine-specific extra functions currently do not support alignment restrictions. FnVal::Other(_) => Align::ONE, -- cgit 1.4.1-3-g733a5 From fe720181b52157f9a7195b3d9b0b28b20dc9583d Mon Sep 17 00:00:00 2001 From: zachs18 <8355914+zachs18@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:06:13 -0500 Subject: Update compiler/rustc_const_eval/src/interpret/memory.rs Replace commented-out code with link to context for change. Co-authored-by: Ralf Jung --- compiler/rustc_const_eval/src/interpret/memory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_const_eval/src/interpret/memory.rs') diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index bbde7c66acc..23b40894f16 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -941,7 +941,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // FIXME: Until we have a clear design for the effects of align(N) functions // on the address of function pointers, we don't consider the align(N) // attribute on functions in the interpreter. - //self.tcx.codegen_instance_attrs(instance.def).alignment.unwrap_or(Align::ONE) + // See for more context. Align::ONE } // Machine-specific extra functions currently do not support alignment restrictions. -- cgit 1.4.1-3-g733a5