Skip to content

Commit 80f8aeb

Browse files
committed
Fix awkward wording.
1 parent 84d77be commit 80f8aeb

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

core/src/mem/manually_drop.rs

+9-10
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,21 @@ use crate::ptr;
6363
/// # Safety hazards when storing `ManuallyDrop` in a struct or an enum.
6464
///
6565
/// Special care is needed when all of the conditions below are met:
66-
/// * A field of a struct or enum is a `ManuallyDrop` or contains a
67-
/// `ManuallyDrop`, without the `ManuallyDrop` being inside a `union`.
66+
/// * A struct or enum contains a `ManuallyDrop`.
67+
/// * The `ManuallyDrop` is not inside a `union`.
6868
/// * The struct or enum is part of public API, or is stored in a struct or an
6969
/// enum that is part of public API.
70-
/// * There is code outside of a `Drop` implementation that calls
71-
/// [`ManuallyDrop::drop`] or [`ManuallyDrop::take`] on the `ManuallyDrop`
72-
/// field.
70+
/// * There is code that drops the contents of the `ManuallyDrop` field, and
71+
/// this code is outside the struct or enum's `Drop` implementation.
7372
///
74-
/// In particular, the following hazards can occur:
73+
/// In particular, the following hazards may occur:
7574
///
7675
/// #### Storing generic types
7776
///
7877
/// If the `ManuallyDrop` contains a client-supplied generic type, the client
79-
/// might provide a `Box`, causing undefined behavior when the struct / enum is
80-
/// later moved, as mentioned above. For example, the following code causes
81-
/// undefined behavior:
78+
/// might provide a `Box` as that type. This would cause undefined behavior when
79+
/// the struct or enum is later moved, as mentioned in the previous section. For
80+
/// example, the following code causes undefined behavior:
8281
///
8382
/// ```no_run
8483
/// use std::mem::ManuallyDrop;
@@ -114,7 +113,7 @@ use crate::ptr;
114113
/// #### Deriving traits
115114
///
116115
/// Deriving `Debug`, `Clone`, `PartialEq`, `PartialOrd`, `Ord`, or `Hash` on
117-
/// the struct / enum could be unsound, since the derived implementations of
116+
/// the struct or enum could be unsound, since the derived implementations of
118117
/// these traits would access the `ManuallyDrop` field. For example, the
119118
/// following code causes undefined behavior:
120119
///

0 commit comments

Comments
 (0)