diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2025-06-23 12:17:31 +0300 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2025-06-23 12:17:31 +0300 |
| commit | 3c4a690d018bebe98cf5ebfdfbf4388d131121c9 (patch) | |
| tree | 8ba69fe791545d69bd1d6fd93318b8bc76449a18 /compiler/rustc_const_eval/src/interpret | |
| parent | 3db7cffd54008792421a801e80701465c8977abd (diff) | |
| parent | 1052ddda964811c25823aa7285595f7085392b36 (diff) | |
| download | rust-3c4a690d018bebe98cf5ebfdfbf4388d131121c9.tar.gz rust-3c4a690d018bebe98cf5ebfdfbf4388d131121c9.zip | |
Merge from rust-lang/rust
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/memory.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 99a4bc1b7d6..57bf867e389 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -877,12 +877,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { if let Some(fn_val) = self.get_fn_alloc(id) { let align = match fn_val { FnVal::Instance(instance) => { - // Function alignment can be set globally with the `-Zmin-function-alignment=<n>` flag; - // the alignment from a `#[repr(align(<n>))]` is used if it specifies a higher alignment. - let fn_align = self.tcx.codegen_fn_attrs(instance.def_id()).alignment; - let global_align = self.tcx.sess.opts.unstable_opts.min_function_alignment; - - Ord::max(global_align, fn_align).unwrap_or(Align::ONE) + self.tcx.codegen_fn_attrs(instance.def_id()).alignment.unwrap_or(Align::ONE) } // Machine-specific extra functions currently do not support alignment restrictions. FnVal::Other(_) => Align::ONE, @@ -1412,8 +1407,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { let src_alloc = self.get_alloc_raw(src_alloc_id)?; let src_range = alloc_range(src_offset, size); assert!(!self.memory.validation_in_progress.get(), "we can't be copying during validation"); - // For the overlapping case, it is crucial that we trigger the read hook + + // Trigger read hooks. + // For the overlapping case, it is crucial that we trigger the read hooks // before the write hook -- the aliasing model cares about the order. + if let Ok((alloc_id, ..)) = self.ptr_try_get_alloc_id(src, size.bytes() as i64) { + M::before_alloc_read(self, alloc_id)?; + } M::before_memory_read( tcx, &self.machine, |
