about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Liebow-Feeser <joshlf@users.noreply.github.com>2023-09-03 18:12:27 -0700
committerGitHub <noreply@github.com>2023-09-03 18:12:27 -0700
commita16622f62f10b76af9b61d5177f6e3bb8bdb09b5 (patch)
tree115a17f45ffec7cdf9b85bc7795507ea58fd91c4
parentabfc6c44381fb033c6b3b0a6bfb804a799f39afd (diff)
downloadrust-a16622f62f10b76af9b61d5177f6e3bb8bdb09b5.tar.gz
rust-a16622f62f10b76af9b61d5177f6e3bb8bdb09b5.zip
Clarify ManuallyDrop bit validity
Clarify that `ManuallyDrop<T>` has the same bit validity as `T`.
-rw-r--r--library/core/src/mem/manually_drop.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/core/src/mem/manually_drop.rs b/library/core/src/mem/manually_drop.rs
index 5f3d66e3773..98cff3493a7 100644
--- a/library/core/src/mem/manually_drop.rs
+++ b/library/core/src/mem/manually_drop.rs
@@ -4,12 +4,12 @@ use crate::ptr;
 /// A wrapper to inhibit compiler from automatically calling `T`’s destructor.
 /// This wrapper is 0-cost.
 ///
-/// `ManuallyDrop<T>` is guaranteed to have the same layout as `T`, and is subject
-/// to the same layout optimizations as `T`. As a consequence, it has *no effect*
-/// on the assumptions that the compiler makes about its contents. For example,
-/// initializing a `ManuallyDrop<&mut T>` with [`mem::zeroed`] is undefined
-/// behavior. If you need to handle uninitialized data, use [`MaybeUninit<T>`]
-/// instead.
+/// `ManuallyDrop<T>` is guaranteed to have the same layout and bit validity as
+/// `T`, and is subject to the same layout optimizations as `T`. As a consequence,
+/// it has *no effect* on the assumptions that the compiler makes about its
+/// contents. For example, initializing a `ManuallyDrop<&mut T>` with [`mem::zeroed`]
+/// is undefined behavior. If you need to handle uninitialized data, use
+/// [`MaybeUninit<T>`] instead.
 ///
 /// Note that accessing the value inside a `ManuallyDrop<T>` is safe.
 /// This means that a `ManuallyDrop<T>` whose content has been dropped must not