Skip to content

Commit

Permalink
Rollup merge of rust-lang#80398 - CAD97:fix-80365, r=dtolnay
Browse files Browse the repository at this point in the history
Use raw version of align_of in rc data_offset

This was missed in rust-lang#73845 when switching to use the raw operators.
Fixes rust-lang#80365
  • Loading branch information
m-ou-se authored Dec 28, 2020
2 parents bae6475 + eeed311 commit 7003537
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use core::hint;
use core::intrinsics::abort;
use core::iter;
use core::marker::{PhantomData, Unpin, Unsize};
use core::mem::{self, align_of_val, size_of_val};
use core::mem::{self, align_of_val_raw, size_of_val};
use core::ops::{CoerceUnsized, Deref, DispatchFromDyn, Receiver};
use core::pin::Pin;
use core::ptr::{self, NonNull};
Expand Down Expand Up @@ -2366,7 +2366,7 @@ unsafe fn data_offset<T: ?Sized>(ptr: *const T) -> isize {
// Because it is `?Sized`, it will always be the last field in memory.
// Note: This is a detail of the current implementation of the compiler,
// and is not a guaranteed language detail. Do not rely on it outside of std.
unsafe { data_offset_align(align_of_val(&*ptr)) }
unsafe { data_offset_align(align_of_val_raw(ptr)) }
}

#[inline]
Expand Down

0 comments on commit 7003537

Please sign in to comment.