1
Fork 0

Rollup merge of #100893 - thinety:master, r=scottmcm

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.
This commit is contained in:
Matthias Krüger 2022-08-23 06:55:31 +02:00 committed by GitHub
commit 683a08af6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]);
/// }