diff options
| author | William Brown <william@blackhats.net.au> | 2018-12-19 12:40:57 +1000 |
|---|---|---|
| committer | William Brown <william@blackhats.net.au> | 2018-12-19 12:40:57 +1000 |
| commit | 0829d0c0e480a3729dcfe4f28f5969277dc8f646 (patch) | |
| tree | cd258532180b187be1f5beb4697ad7666ce0fb69 | |
| parent | 00bd306e0d060fc737d670e9aacd2789d3103785 (diff) | |
| download | rust-0829d0c0e480a3729dcfe4f28f5969277dc8f646.tar.gz rust-0829d0c0e480a3729dcfe4f28f5969277dc8f646.zip | |
Updates based on comment
| -rw-r--r-- | src/libcore/mem.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 7e4e83999c1..7492cf4c5ed 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -531,9 +531,9 @@ pub unsafe fn zeroed<T>() -> T { /// includes a `panic` occurring and unwinding the stack suddenly. /// /// If you partially initialize an array, you may need to use -/// [`ptr::drop_in_place`][drop_in_place] to remove the set you have created -/// followed by [`mem::forget`][mem_forget] to prevent drop running on the -/// array. If a partially allocated array is dropped this may lead to +/// [`ptr::drop_in_place`][drop_in_place] to remove the elements you have fully +/// initialized followed by [`mem::forget`][mem_forget] to prevent drop running +/// on the array. If a partially allocated array is dropped this will lead to /// undefined behaviour. /// /// # Examples @@ -589,7 +589,7 @@ pub unsafe fn zeroed<T>() -> T { /// println!("{:?}", &data[0]); /// ``` /// -/// This example shows how to handle partially allocated arrays, which could +/// This example shows how to handle partially initialized arrays, which could /// be found in low-level datastructures. /// /// ``` @@ -618,10 +618,6 @@ pub unsafe fn zeroed<T>() -> T { /// mem::forget(data); /// ``` /// -/// An alternate strategy is to use [`mem::zeroed`][mem_zeroed] with ptr -/// comparison. This is a very error prone strategy and may only be relevant -/// for FFI. -/// /// [`Vec`]: ../../std/vec/struct.Vec.html /// [`vec!`]: ../../std/macro.vec.html /// [`Clone`]: ../../std/clone/trait.Clone.html |
