Stream: t-lang/wg-unsafe-code-guidelines

Topic: Copying uninitialized memory


Amanieu (Mar 16 2020 at 15:10, on Zulip):

Is it legal to copy uninitialized memory using ptr::copy_nonoverlapping? The use case here is for hashbrown's Clone implementation, where (for Copy types) we copy the entire bucket array, some of which may be empty (and therefore uninitialized).

Lokathor (Mar 16 2020 at 16:20, on Zulip):

Yes, the memory is just still uninitialized at the destination as well.

RalfJ (Mar 17 2020 at 12:15, on Zulip):

@Amanieu also see https://github.com/rust-lang/rust/pull/67827. there was an attempt to put this into the docs but it died off.

Last update: Jun 05 2020 at 20:55UTC