Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 804cf26

Browse files
committedMar 3, 2025
DO NOT MERGE WITH THIS -- add an assert to try to find the bad iterator
1 parent 76f763c commit 804cf26

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎library/alloc/src/vec/spec_from_iter_nested.rs

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ where
2323
// vector being full in the few subsequent loop iterations.
2424
// So we get better branch prediction.
2525
let (low, high) = iterator.size_hint();
26+
assert!(
27+
high.is_none_or(|high| low <= high),
28+
"size_hint ({low:?}, {high:?}) is malformed from iterator {} collecting into {}",
29+
core::any::type_name::<I>(), core::any::type_name::<Self>(),
30+
);
31+
2632
let Some(first) = iterator.next() else {
2733
return Vec::new();
2834
};

0 commit comments

Comments
 (0)
Failed to load comments.