Skip to content

Commit 6b73820

Browse files
committed
Read the slice length from the correct place in the fat pointer
1 parent 06afdf8 commit 6b73820

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const<'_>) -> fmt::Resu
24942494
if let Ok(ptr) = ptr {
24952495
let len = ty::tls::with(|tcx| alloc.read_bits(
24962496
tcx,
2497-
offset,
2497+
offset + tcx.data_layout.pointer_size,
24982498
ParamEnv::reveal_all().and(tcx.types.usize),
24992499
).ok());
25002500
if let Some(len) = len {

0 commit comments

Comments
 (0)