Vec::into_boxed_slice calls shrink_to_fit internally.
That method explicitly states in the docs that it may leave some excess capacity, which the current implementation however does not.
I have a PR coming soon that will actually make use of alloc::usable_size to actually use excess capacity.
But that fails, because into_boxed_slice calls out to RawVec::into_box which actually assumes len() == capacity() and thus leads to segfaults.
Vec::into_boxed_slicecallsshrink_to_fitinternally.That method explicitly states in the docs that it may leave some excess capacity, which the current implementation however does not.
I have a PR coming soon that will actually make use of
alloc::usable_sizeto actually use excess capacity.But that fails, because
into_boxed_slicecalls out toRawVec::into_boxwhich actually assumeslen() == capacity()and thus leads to segfaults.