about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorThe8472 <git@infinite-source.de>2019-11-15 01:27:41 +0100
committerThe8472 <git@infinite-source.de>2020-09-03 20:59:06 +0200
commit73a982e9ecc81ad40b3c7f35ef6a4387140fa12f (patch)
tree39711b313be0c8ab3827ff1abaaa542161b06330 /library/alloc/src
parent2a327394e4ae84600f506079fddd0e2bb1959b06 (diff)
assert that SourceIter requirements have not been violated by the pipeline
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/vec.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs
index e7d61dcde45..b21f2a90844 100644
--- a/library/alloc/src/vec.rs
+++ b/library/alloc/src/vec.rs
@@ -2131,12 +2131,14 @@ where
     I: Iterator<Item = T> + InPlaceIterable + SourceIter<Source = IntoIter<T>>,
 {
     let mut insert_pos = 0;
+    let original_ptr = iterator.as_inner().buf.as_ptr();
 
     // FIXME: how to drop values written into source when iteration panics?
     //   tail already gets cleaned by IntoIter::drop
     while let Some(item) = iterator.next() {
         let source_iter = iterator.as_inner();
         let src_buf = source_iter.buf.as_ptr();
+        debug_assert_eq!(original_ptr, src_buf);
         let src_idx = source_iter.ptr;
         unsafe {
             let dst = src_buf.offset(insert_pos as isize);