diff options
| author | Joshua Liebow-Feeser <joshlf@users.noreply.github.com> | 2022-11-06 16:08:05 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-06 16:08:05 -0800 |
| commit | 72a9029b84d0c2dcf10cee08d39f8a64964df22d (patch) | |
| tree | b7593b739d787fe718b509b9e61fd716bd37a243 | |
| parent | 7eef946fc0e0eff40e588eab77b09b287accbec3 (diff) | |
| download | rust-72a9029b84d0c2dcf10cee08d39f8a64964df22d.tar.gz rust-72a9029b84d0c2dcf10cee08d39f8a64964df22d.zip | |
PhantomData layout guarantees
| -rw-r--r-- | library/core/src/marker.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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<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")] |
