thin-vec
thin-vec copied to clipboard
Initialize the header before calling `set_cap()`/`set_len()`
Inside header_with_capacity(), the calls to set_cap() and set_len() seem to create a mutable ref to uninitialized data. This change uses std::ptr::write() to avoid creating a reference until the header is initialized. This seems possibly more future-proof in case of any changes to rustc.