diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 9046403e9079c..fd26621051981 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -2106,6 +2106,8 @@ impl Unpin for Rc { } unsafe fn data_offset(ptr: *const T) -> isize { // Align the unsized value to the end of the `RcBox`. // 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. data_offset_align(align_of_val(&*ptr)) } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 88027d48e8a21..3343384754f51 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -2161,6 +2161,8 @@ impl Unpin for Arc { } unsafe fn data_offset(ptr: *const T) -> isize { // Align the unsized value to the end of the `ArcInner`. // 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. data_offset_align(align_of_val(&*ptr)) }