diff options
| author | Paolo Barbolini <paolo@paolo565.org> | 2021-06-18 15:14:22 +0200 |
|---|---|---|
| committer | Paolo Barbolini <paolo@paolo565.org> | 2021-06-18 15:14:22 +0200 |
| commit | d8530d0fa31224a2506a0932af5ac18d86c1bb0f (patch) | |
| tree | ff674db91f654eb9793cb3f2424dfc24ff4efd8d | |
| parent | 966361fe495def7f6ceb63fa769b892089e19cb3 (diff) | |
| download | rust-d8530d0fa31224a2506a0932af5ac18d86c1bb0f.tar.gz rust-d8530d0fa31224a2506a0932af5ac18d86c1bb0f.zip | |
Use `copy_nonoverlapping` to copy `bytes` in `String::insert_bytes`
| -rw-r--r-- | library/alloc/src/string.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 93f5fe45cd6..a34f530762d 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1451,7 +1451,7 @@ impl String { unsafe { ptr::copy(self.vec.as_ptr().add(idx), self.vec.as_mut_ptr().add(idx + amt), len - idx); - ptr::copy(bytes.as_ptr(), self.vec.as_mut_ptr().add(idx), amt); + ptr::copy_nonoverlapping(bytes.as_ptr(), self.vec.as_mut_ptr().add(idx), amt); self.vec.set_len(len + amt); } } |
