]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #61398 - kennytm:stabilize-copy-within, r=SimonSapin
authorMazdak Farrokhzad <twingoow@gmail.com>
Wed, 12 Jun 2019 23:49:26 +0000 (01:49 +0200)
committerGitHub <noreply@github.com>
Wed, 12 Jun 2019 23:49:26 +0000 (01:49 +0200)
Stabilize copy_within

Closes #54236.

1  2 
src/libcore/slice/mod.rs
src/libcore/tests/lib.rs

diff --combined src/libcore/slice/mod.rs
index c9c73f4d66ee9f85fe63f756fa8c6233dc558bcc,231082e5a17562c65939a99d32f37a023fb5af7d..d93e5a9ca2b6348e88f8c7e208acd810d4a4970e
@@@ -2146,14 -2146,13 +2146,13 @@@ impl<T> [T] 
      /// Copying four bytes within a slice:
      ///
      /// ```
-     /// # #![feature(copy_within)]
      /// let mut bytes = *b"Hello, World!";
      ///
      /// bytes.copy_within(1..5, 8);
      ///
      /// assert_eq!(&bytes, b"Hello, Wello!");
      /// ```
-     #[unstable(feature = "copy_within", issue = "54236")]
+     #[stable(feature = "copy_within", since = "1.37.0")]
      pub fn copy_within<R: ops::RangeBounds<usize>>(&mut self, src: R, dest: usize)
      where
          T: Copy,
          assert!(dest <= self.len() - count, "dest is out of bounds");
          unsafe {
              ptr::copy(
-                 self.get_unchecked(src_start),
-                 self.get_unchecked_mut(dest),
+                 self.as_ptr().add(src_start),
+                 self.as_mut_ptr().add(dest),
                  count,
              );
          }
@@@ -5420,7 -5419,7 +5419,7 @@@ macro_rules! impl_marker_for 
  }
  
  impl_marker_for!(BytewiseEquality,
 -                 u8 i8 u16 i16 u32 i32 u64 i64 usize isize char bool);
 +                 u8 i8 u16 i16 u32 i32 u64 i64 u128 i128 usize isize char bool);
  
  #[doc(hidden)]
  unsafe impl<'a, T> TrustedRandomAccess for Iter<'a, T> {
diff --combined src/libcore/tests/lib.rs
index 928bdd7a7600256cff29cea50e4c7a75a09f464a,d789c22053a55e1dd990ba8d36a93d11af2b4420..bf072a9243b5107b5e9cea84be5b66baebaedfe7
@@@ -1,4 -1,3 +1,4 @@@
 +#![feature(bound_cloned)]
  #![feature(box_syntax)]
  #![feature(cell_update)]
  #![feature(core_private_bignum)]
@@@ -11,6 -10,7 +11,6 @@@
  #![feature(fmt_internals)]
  #![feature(hashmap_internals)]
  #![feature(is_sorted)]
 -#![feature(iter_nth_back)]
  #![feature(iter_once_with)]
  #![feature(pattern)]
  #![feature(range_is_empty)]
  #![feature(test)]
  #![feature(trusted_len)]
  #![feature(try_trait)]
 -#![feature(reverse_bits)]
  #![feature(inner_deref)]
  #![feature(slice_internals)]
  #![feature(slice_partition_dedup)]
- #![feature(copy_within)]
  #![feature(int_error_matching)]
  #![feature(const_fn)]
  #![warn(rust_2018_idioms)]