When using one of the functions to convert a Vec<T> to a [T], excess capacity of the vector is dropped, leaving the slice with only the elements which have been initialised in memory.
This behaviour is acknowledged in the documentation for Vec::into_boxed_slice, but not in the documentation for Vec::leak.
When using one of the functions to convert a
Vec<T>to a[T], excess capacity of the vector is dropped, leaving the slice with only the elements which have been initialised in memory.This behaviour is acknowledged in the documentation for
Vec::into_boxed_slice, but not in the documentation forVec::leak.