From 80f7db63b6e658468f181d602767c8da412459d2 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 Feb 2017 11:26:44 -0800 Subject: [PATCH] std: Fix IntoIter::as_mut_slice's signature This was intended to require `&mut self`, not `&self`, otherwise it's unsound! Closes #39465 --- src/libcollections/vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 1f8fd32da9ab8..c45518438bd83 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1958,7 +1958,7 @@ impl IntoIter { /// 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()) }