diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2025-06-20 13:36:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 13:36:01 -0400 |
| commit | 5d6ecf584e9c28e137daa4f82aee8ce0fb63c30a (patch) | |
| tree | e93090bd987e1150cd7fad7fbbe415dc84703d7d /compiler/rustc_const_eval/src | |
| parent | bad4bf54f0609db4f70c70f331a9153b3004ca89 (diff) | |
| parent | cfc22cfffb7a75229752de6a76e2fc94791b5203 (diff) | |
| download | rust-5d6ecf584e9c28e137daa4f82aee8ce0fb63c30a.tar.gz rust-5d6ecf584e9c28e137daa4f82aee8ce0fb63c30a.zip | |
Rollup merge of #142575 - oli-obk:sneaky-self-init, r=RalfJung
Ensure copy* intrinsics also perform the static self-init checks fixes rust-lang/rust#142532 r? `@RalfJung`
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/memory.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 99a4bc1b7d6..36d1a413598 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -1412,8 +1412,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, |
