diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 8f7b8efd811f7..ab64d5330874f 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -1711,7 +1711,7 @@ impl Weak { // because dangling weaks are only created for sized T. wrapping_offset // is used so that we can use the same code path for dangling weak refs. unsafe { - let offset = data_offset(&raw const (*ptr).value); + let offset = data_offset(fake_ptr); set_data_ptr(fake_ptr, (ptr as *mut u8).wrapping_offset(offset)) } } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 27c36f4a56933..e9af80d326f44 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -1479,7 +1479,7 @@ impl Weak { // because dangling weaks are only created for sized T. wrapping_offset // is used so that we can use the same code path for dangling weak refs. unsafe { - let offset = data_offset(&raw const (*ptr).data); + let offset = data_offset(fake_ptr); set_data_ptr(fake_ptr, (ptr as *mut u8).wrapping_offset(offset)) } }