Skip to content

Commit 72a9029

Browse files
authored
PhantomData layout guarantees
1 parent 7eef946 commit 72a9029

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/core/src/marker.rs

+6
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,12 @@ impl<T: ?Sized> !Sync for *mut T {}
621621
/// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so
622622
/// as not to indicate ownership.
623623
///
624+
/// ## Layout
625+
///
626+
/// For all `T`, the following are guaranteed:
627+
/// * `size_of::<PhantomData<T>>() == 0`
628+
/// * `align_of::<PhantomData<T>>() == 1`
629+
///
624630
/// [drop check]: ../../nomicon/dropck.html
625631
#[lang = "phantom_data"]
626632
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)