PhantomData layout guarantees
This commit is contained in:
parent
7eef946fc0
commit
72a9029b84
@ -621,6 +621,12 @@ impl<T: ?Sized> !Sync for *mut T {}
|
|||||||
/// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so
|
/// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so
|
||||||
/// as not to indicate ownership.
|
/// as not to indicate ownership.
|
||||||
///
|
///
|
||||||
|
/// ## Layout
|
||||||
|
///
|
||||||
|
/// For all `T`, the following are guaranteed:
|
||||||
|
/// * `size_of::<PhantomData<T>>() == 0`
|
||||||
|
/// * `align_of::<PhantomData<T>>() == 1`
|
||||||
|
///
|
||||||
/// [drop check]: ../../nomicon/dropck.html
|
/// [drop check]: ../../nomicon/dropck.html
|
||||||
#[lang = "phantom_data"]
|
#[lang = "phantom_data"]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
Loading…
Reference in New Issue
Block a user