From 72a9029b84d0c2dcf10cee08d39f8a64964df22d Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Sun, 6 Nov 2022 16:08:05 -0800 Subject: [PATCH] PhantomData layout guarantees --- library/core/src/marker.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index ae4ebf44442..26b7dddcd2e 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -621,6 +621,12 @@ impl !Sync for *mut T {} /// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so /// as not to indicate ownership. /// +/// ## Layout +/// +/// For all `T`, the following are guaranteed: +/// * `size_of::>() == 0` +/// * `align_of::>() == 1` +/// /// [drop check]: ../../nomicon/dropck.html #[lang = "phantom_data"] #[stable(feature = "rust1", since = "1.0.0")]