Skip to content

Commit

Permalink
std: Fix IntoIter::as_mut_slice's signature
Browse files Browse the repository at this point in the history
This was intended to require `&mut self`, not `&self`, otherwise it's unsound!

Closes #39465
  • Loading branch information
alexcrichton committed Feb 2, 2017
1 parent 24055d0 commit 80f7db6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 80f7db6

Please sign in to comment.