std: Fix IntoIter::as_mut_slice's signature

This was intended to require `&mut self`, not `&self`, otherwise it's unsound!

Closes #39465
This commit is contained in:
Alex Crichton 2017-02-02 11:26:44 -08:00
parent 24055d0f2a
commit 80f7db63b6

View file

@ -1958,7 +1958,7 @@ impl<T> IntoIter<T> {
/// assert_eq!(into_iter.next().unwrap(), 'z');
/// ```
#[stable(feature = "vec_into_iter_as_slice", since = "1.15.0")]
pub fn as_mut_slice(&self) -> &mut [T] {
pub fn as_mut_slice(&mut self) -> &mut [T] {
unsafe {
slice::from_raw_parts_mut(self.ptr as *mut T, self.len())
}