Skip to content

Commit 58c3999

Browse files
improve drop_in_place docs
1 parent b2ef9f7 commit 58c3999

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/core/src/ptr/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,10 @@ mod mut_ptr;
443443
/// ```
444444
/// # struct Foo { x: i32 }
445445
/// unsafe fn drop_in_place(to_drop: *mut Foo) {
446-
/// let mut value = &mut *to_drop;
447-
/// // ... drop the fields of `value` ...
446+
/// drop_in_place_inner(&mut *to_drop);
447+
/// unsafe fn drop_in_place_inner(to_drop: &mut Foo) {
448+
/// // ... drop the fields of `value` ...
449+
/// }
448450
/// }
449451
/// ```
450452
///
@@ -453,9 +455,9 @@ mod mut_ptr;
453455
///
454456
/// * `to_drop` must be [valid] for both reads and writes.
455457
///
456-
/// * `to_drop` must be properly aligned, even if T has size 0.
458+
/// * `to_drop` must be properly aligned, even if `T` has size 0.
457459
///
458-
/// * `to_drop` must be nonnull, even if T has size 0.
460+
/// * `to_drop` must be nonnull, even if `T` has size 0.
459461
///
460462
/// * The value `to_drop` points to must be valid for dropping, which may mean
461463
/// it must uphold additional invariants. These invariants depend on the type

0 commit comments

Comments
 (0)