Skip to content

Commit 7003537

Browse files
authored
Rollup merge of #80398 - CAD97:fix-80365, r=dtolnay
Use raw version of align_of in rc data_offset This was missed in #73845 when switching to use the raw operators. Fixes #80365
2 parents bae6475 + eeed311 commit 7003537

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/alloc/src/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use core::hint;
1414
use core::intrinsics::abort;
1515
use core::iter;
1616
use core::marker::{PhantomData, Unpin, Unsize};
17-
use core::mem::{self, align_of_val, size_of_val};
17+
use core::mem::{self, align_of_val_raw, size_of_val};
1818
use core::ops::{CoerceUnsized, Deref, DispatchFromDyn, Receiver};
1919
use core::pin::Pin;
2020
use core::ptr::{self, NonNull};
@@ -2366,7 +2366,7 @@ unsafe fn data_offset<T: ?Sized>(ptr: *const T) -> isize {
23662366
// Because it is `?Sized`, it will always be the last field in memory.
23672367
// Note: This is a detail of the current implementation of the compiler,
23682368
// and is not a guaranteed language detail. Do not rely on it outside of std.
2369-
unsafe { data_offset_align(align_of_val(&*ptr)) }
2369+
unsafe { data_offset_align(align_of_val_raw(ptr)) }
23702370
}
23712371

23722372
#[inline]

0 commit comments

Comments
 (0)