diff options
| author | bors <bors@rust-lang.org> | 2025-09-17 13:56:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-09-17 13:56:54 +0000 |
| commit | 5d1b897a07dc30d810dd541795125c1c216266c7 (patch) | |
| tree | 039c32657725cddbb0528af54157fc9385063a95 /compiler/rustc_const_eval/src | |
| parent | ce6daf3d5a5bffb2a00264197f92dc31608df0da (diff) | |
| parent | 7abbc9c8b2c638752e2a6b0913ed1e93e14d21ba (diff) | |
| download | rust-5d1b897a07dc30d810dd541795125c1c216266c7.tar.gz rust-5d1b897a07dc30d810dd541795125c1c216266c7.zip | |
Auto merge of #146331 - RalfJung:copy-prov-repeat, r=oli-obk
interpret: copy_provenance: avoid large intermediate buffer for large repeat counts Copying provenance worked in this odd way where the "preparation" phase (which is supposed to just extract the necessary information from the source range) already did all the work of repeating the result N times for the target range. This was needed to use the existing `insert_presorted` function on `SortedMap`. This PR generalizes `insert_presorted` so that we can avoid this odd structure on copy-provenance, and maybe even improve performance.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/memory.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index ebcdb9461d0..323e1cefd58 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -1504,7 +1504,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // This will also error if copying partial provenance is not supported. let provenance = src_alloc .provenance() - .prepare_copy(src_range, dest_offset, num_copies, self) + .prepare_copy(src_range, self) .map_err(|e| e.to_interp_error(src_alloc_id))?; // Prepare a copy of the initialization mask. let init = src_alloc.init_mask().prepare_copy(src_range); @@ -1590,7 +1590,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { num_copies, ); // copy the provenance to the destination - dest_alloc.provenance_apply_copy(provenance); + dest_alloc.provenance_apply_copy(provenance, alloc_range(dest_offset, size), num_copies); interp_ok(()) } |
