about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcollections/vec.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 50ad4856747..8bed02c79e0 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -1578,7 +1578,13 @@ impl<I> IsTrustedLen for I where I: Iterator { }
 impl<I> IsTrustedLen for I where I: TrustedLen
 {
     fn trusted_len(&self) -> Option<usize> {
-        self.size_hint().1
+        let (low, high) = self.size_hint();
+        if let Some(high_value) = high {
+            debug_assert_eq!(low, high_value,
+                             "TrustedLen iterator's size hint is not exact: {:?}",
+                             (low, high));
+        }
+        high
     }
 }