We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 69c1421 + 9dfff98 commit cc6a6baCopy full SHA for cc6a6ba
1 file changed
src/exception-safety.md
@@ -41,11 +41,13 @@ impl<T: Clone> Vec<T> {
41
fn push_all(&mut self, to_push: &[T]) {
42
self.reserve(to_push.len());
43
unsafe {
44
+ let end_ptr = self.as_mut_ptr().add(self.len());
45
+
46
// can't overflow because we just reserved this
47
self.set_len(self.len() + to_push.len());
48
49
for (i, x) in to_push.iter().enumerate() {
- self.ptr().add(i).write(x.clone());
50
+ end_ptr.add(i).write(x.clone());
51
}
52
53
0 commit comments