about summary refs log tree commit diff
path: root/src/liballoc/rc.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-22 02:40:07 +0100
committerGitHub <noreply@github.com>2019-12-22 02:40:07 +0100
commitca528fcc046aca3e1cccb74a4bbebe855df3e3b6 (patch)
tree3500405d97633983e4fa3013a7d95e39bdecd74a /src/liballoc/rc.rs
parentc35546383f89aa7255679f40094c9ad113c63dd6 (diff)
parenta34c2677afeee2747d680536f302a8c5665a65f4 (diff)
downloadrust-ca528fcc046aca3e1cccb74a4bbebe855df3e3b6.tar.gz
rust-ca528fcc046aca3e1cccb74a4bbebe855df3e3b6.zip
Rollup merge of #67504 - Mark-Simulacrum:note-data-offset, r=Centril
Warn against relying on ?Sized being last

Fixes #62522
Diffstat (limited to 'src/liballoc/rc.rs')
-rw-r--r--src/liballoc/rc.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 9046403e907..fd266210519 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -2106,6 +2106,8 @@ impl<T: ?Sized> Unpin for Rc<T> { }
 unsafe fn data_offset<T: ?Sized>(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))
 }