diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-12-18 10:08:37 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-12-18 10:08:37 +0100 |
| commit | 50eb5f6137719a7e8fdd270e90af0d734d002c5d (patch) | |
| tree | c0231e7a82e13bc4c16e03c4f8dc615c33b943aa /src | |
| parent | 3e7a4ca2f1d576a4a23e8c541cb5c0c420b108de (diff) | |
Explain the math
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/interpret/memory.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 65347a02be0..77a5f5d7b3a 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -707,10 +707,15 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { new_relocations.extend( relocations .iter() - .map(|&(offset, reloc)| ( - offset + dest.offset - src.offset + (i * size), - reloc, - )) + .map(|&(offset, reloc)| { + // compute offset for current repetition + let dest_offset = dest.offset + (i * size); + ( + // shift offsets from source allocation to destination allocation + offset + dest_offset - src.offset, + reloc, + ) + }) ); } |
