Skip to content

Commit

Permalink
Rollup merge of #100893 - thinety:master, r=scottmcm
Browse files Browse the repository at this point in the history
Remove out-of-context comment in `mem::MaybeUninit` documentation

Reverted the comment to an earlier version to avoid confusion: neither raw pointer assignment nor `ptr::write` is used inside the for loop.
  • Loading branch information
matthiaskrgr authored Aug 23, 2022
2 parents 234e0f2 + 3d2b61c commit 683a08a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions library/core/src/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,8 @@ use crate::slice;
/// MaybeUninit::uninit().assume_init()
/// };
///
/// // Dropping a `MaybeUninit` does nothing. Thus using raw pointer
/// // assignment instead of `ptr::write` does not cause the old
/// // uninitialized value to be dropped. Also if there is a panic during
/// // this loop, we have a memory leak, but there is no memory safety
/// // issue.
/// // Dropping a `MaybeUninit` does nothing, so if there is a panic during this loop,
/// // we have a memory leak, but there is no memory safety issue.
/// for elem in &mut data[..] {
/// elem.write(vec![42]);
/// }
Expand Down

0 comments on commit 683a08a

Please sign in to comment.