]> git.proxmox.com Git - rustc.git/blobdiff - library/alloc/src/vec/source_iter_marker.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / library / alloc / src / vec / source_iter_marker.rs
index e857d284d3ab654d14710d73d08a921f96f6661e..d814d4ae355b0496eb08f08400aeb8a3bf35df83 100644 (file)
@@ -89,6 +89,8 @@ fn write_in_place_with_drop<T>(
             // all we can do is check if it's still in range
             debug_assert!(sink.dst as *const _ <= src_end, "InPlaceIterable contract violation");
             ptr::write(sink.dst, item);
+            // Since this executes user code which can panic we have to bump the pointer
+            // after each step.
             sink.dst = sink.dst.add(1);
         }
         Ok(sink)
@@ -136,6 +138,8 @@ where
                 let dst = dst_buf.offset(i as isize);
                 debug_assert!(dst as *const _ <= end, "InPlaceIterable contract violation");
                 ptr::write(dst, self.__iterator_get_unchecked(i));
+                // Since this executes user code which can panic we have to bump the pointer
+                // after each step.
                 drop_guard.dst = dst.add(1);
             }
         }