1
Fork 0

Update library/alloc/src/vec/mod.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
This commit is contained in:
Waffle Lapkin 2021-03-03 20:04:20 +03:00 committed by GitHub
parent a1835bcb01
commit 950f12119e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1950,7 +1950,7 @@ impl<T, A: Allocator> Vec<T, A> {
// SAFETY:
// - `ptr` is guaranteed to be valid for `len` elements
// - `spare_ptr` is pointing one element past the buffer, so it doesn't overlap with `initialized` slice
// - `spare_ptr` is pointing one element past the buffer, so it doesn't overlap with `initialized`
unsafe {
let initialized = slice::from_raw_parts_mut(ptr, self.len);
let spare = slice::from_raw_parts_mut(spare_ptr, spare_len);