about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-12-17 00:31:59 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2013-12-17 08:36:04 +1100
commit8a5a5922c61cecd5f305a0cd54671dbf2f2a6519 (patch)
tree80afb3a5745383031154bac2a5737ed2cad477fa /src/libstd
parent5c147cc40847da033674663cedabaf515eda8b20 (diff)
downloadrust-8a5a5922c61cecd5f305a0cd54671dbf2f2a6519.tar.gz
rust-8a5a5922c61cecd5f305a0cd54671dbf2f2a6519.zip
std::vec: convert .copy_memory to use copy_nonoverlapping_memory.
It is required that &mut[]s are disjoint from all other &(mut)[]s, so
this assumption is ok.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/vec.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index a0c94e6810a..2a0f575cdde 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -2060,7 +2060,7 @@ pub trait MutableVector<'a, T> {
      */
     unsafe fn init_elem(self, i: uint, val: T);
 
-    /// Copies data from `src` to `self`
+    /// Copies data from `src` to `self`.
     ///
     /// `self` and `src` must not overlap. Fails if `self` is
     /// shorter than `src`.
@@ -2208,7 +2208,7 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
         self.as_mut_buf(|p_dst, len_dst| {
             src.as_imm_buf(|p_src, len_src| {
                 assert!(len_dst >= len_src)
-                ptr::copy_memory(p_dst, p_src, len_src)
+                ptr::copy_nonoverlapping_memory(p_dst, p_src, len_src)
             })
         })
     }
@@ -2350,10 +2350,10 @@ pub mod bytes {
         }
     }
 
-    /// Copies data from one vector to another.
+    /// Copies data from `src` to `dst`
     ///
-    /// Copies `src` to `dst`. Fails if the length of `dst` is less
-    /// than the length of `src`.
+    /// `src` and `dst` must not overlap. Fails if the length of `dst`
+    /// is less than the length of `src`.
     #[inline]
     pub fn copy_memory(dst: &mut [u8], src: &[u8]) {
         // Bound checks are done at .copy_memory.