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.
1 parent 622f24f commit ee84ec1Copy full SHA for ee84ec1
src/libcollections/vec.rs
@@ -1578,7 +1578,13 @@ impl<I> IsTrustedLen for I where I: Iterator { }
1578
impl<I> IsTrustedLen for I where I: TrustedLen
1579
{
1580
fn trusted_len(&self) -> Option<usize> {
1581
- self.size_hint().1
+ let (low, high) = self.size_hint();
1582
+ if let Some(high_value) = high {
1583
+ debug_assert_eq!(low, high_value,
1584
+ "TrustedLen iterator's size hint is not exact: {:?}",
1585
+ (low, high));
1586
+ }
1587
+ high
1588
}
1589
1590
0 commit comments