We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
copy_nonoverlapping
bytes
String::insert_bytes
1 parent 966361f commit d8530d0Copy full SHA for d8530d0
library/alloc/src/string.rs
@@ -1451,7 +1451,7 @@ impl String {
1451
1452
unsafe {
1453
ptr::copy(self.vec.as_ptr().add(idx), self.vec.as_mut_ptr().add(idx + amt), len - idx);
1454
- 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);
1455
self.vec.set_len(len + amt);
1456
}
1457
0 commit comments