Skip to content

Commit

Permalink
PhantomData layout guarantees
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlf authored Nov 7, 2022
1 parent 7eef946 commit 72a9029
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,12 @@ impl<T: ?Sized> !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::<PhantomData<T>>() == 0`
/// * `align_of::<PhantomData<T>>() == 1`
///
/// [drop check]: ../../nomicon/dropck.html
#[lang = "phantom_data"]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit 72a9029

Please sign in to comment.