Skip to content

Commit 3e7a4ca

Browse files
committed
Remove a wrong multiplier on relocation offset computation
1 parent 640c7ff commit 3e7a4ca

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/librustc_mir/interpret/memory.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -707,10 +707,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
707707
new_relocations.extend(
708708
relocations
709709
.iter()
710-
.map(|&(offset, reloc)| {
711-
(offset + dest.offset - src.offset + (i * size * relocations.len() as u64),
712-
reloc)
713-
})
710+
.map(|&(offset, reloc)| (
711+
offset + dest.offset - src.offset + (i * size),
712+
reloc,
713+
))
714714
);
715715
}
716716

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// compile-pass
2+
3+
fn main() {
4+
let _ = &[("", ""); 3];
5+
}
6+
7+
const FOO: &[(&str, &str)] = &[("", ""); 3];
8+
const BAR: &[(&str, &str); 5] = &[("", ""); 5];
9+
const BAA: &[[&str; 12]; 11] = &[[""; 12]; 11];

0 commit comments

Comments
 (0)