diff options
| author | Zachary S <zasample18+github@gmail.com> | 2025-07-30 15:35:19 -0500 |
|---|---|---|
| committer | Zachary S <zasample18+github@gmail.com> | 2025-07-31 12:50:40 -0500 |
| commit | f554c79ef819cbc0f9983d0d5306cd7a9bfea6d8 (patch) | |
| tree | c3b8c646fb17083c7b8149dbeec9f3b002289520 /compiler/rustc_const_eval/src | |
| parent | 3fb1b53a9dbfcdf37a4b67d35cde373316829930 (diff) | |
| download | rust-f554c79ef819cbc0f9983d0d5306cd7a9bfea6d8.tar.gz rust-f554c79ef819cbc0f9983d0d5306cd7a9bfea6d8.zip | |
Do not give function allocations alignment in consteval or miri.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/memory.rs | 8 |
1 files changed, 6 insertions, 2 deletions
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, |
