From 9b97264d81bfb39f55d645f5c1cccb790dfd9d58 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 25 Sep 2015 17:43:58 +0200 Subject: [PATCH 1/2] Implement AsMut for Vec Fixes #28549 --- src/libcollections/vec.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index c99460a55c952..6375fa489ee2f 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1359,6 +1359,13 @@ impl AsRef<[T]> for Vec { } } +#[stable(feature = "vec_as_mut", since = "1.5.0")] +impl AsMut<[T]> for Vec { + fn as_mut(&mut self) -> &mut [T] { + self + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: Clone> From<&'a [T]> for Vec { #[cfg(not(test))] From 804efdabcdf5c44051845e11cdcd10efa636688e Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 25 Sep 2015 19:54:15 +0200 Subject: [PATCH 2/2] Add AsMut> for Vec --- src/libcollections/vec.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 6375fa489ee2f..7899b4091fce0 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1352,6 +1352,13 @@ impl AsRef> for Vec { } } +#[stable(feature = "vec_as_mut", since = "1.5.0")] +impl AsMut> for Vec { + fn as_mut(&mut self) -> &mut Vec { + self + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl AsRef<[T]> for Vec { fn as_ref(&self) -> &[T] {