diff options
| author | Ralf Jung <post@ralfj.de> | 2020-06-08 09:55:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-08 09:55:28 +0200 |
| commit | 13815e4b35031ea86eefc2aea4515b753388bbb3 (patch) | |
| tree | e6eeaaaebcf9e373338e34d1963aa500afef81be /src/liballoc/vec.rs | |
| parent | e13508786808800b4bc13d49bd5fd1245bc41171 (diff) | |
| parent | 71404633e843e0e5a533c677a764c8cb7f2a55fb (diff) | |
| download | rust-13815e4b35031ea86eefc2aea4515b753388bbb3.tar.gz rust-13815e4b35031ea86eefc2aea4515b753388bbb3.zip | |
Rollup merge of #72811 - pickfire:liballoc-impl, r=Amanieu
Liballoc impl Mainly code rearrangements
Diffstat (limited to 'src/liballoc/vec.rs')
| -rw-r--r-- | src/liballoc/vec.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 9c775eef6a8..af943ecfd48 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1906,6 +1906,22 @@ unsafe impl<T: ?Sized> IsZero for Option<Box<T>> { //////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] +impl<T> ops::Deref for Vec<T> { + type Target = [T]; + + fn deref(&self) -> &[T] { + unsafe { slice::from_raw_parts(self.as_ptr(), self.len) } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl<T> ops::DerefMut for Vec<T> { + fn deref_mut(&mut self) -> &mut [T] { + unsafe { slice::from_raw_parts_mut(self.as_mut_ptr(), self.len) } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Clone> Clone for Vec<T> { #[cfg(not(test))] fn clone(&self) -> Vec<T> { @@ -1961,22 +1977,6 @@ impl<T, I: SliceIndex<[T]>> IndexMut<I> for Vec<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> ops::Deref for Vec<T> { - type Target = [T]; - - fn deref(&self) -> &[T] { - unsafe { slice::from_raw_parts(self.as_ptr(), self.len) } - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl<T> ops::DerefMut for Vec<T> { - fn deref_mut(&mut self) -> &mut [T] { - unsafe { slice::from_raw_parts_mut(self.as_mut_ptr(), self.len) } - } -} - -#[stable(feature = "rust1", since = "1.0.0")] impl<T> FromIterator<T> for Vec<T> { #[inline] fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Vec<T> { |
