about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-01-01 05:39:16 +0000
committerbors <bors@rust-lang.org>2017-01-01 05:39:16 +0000
commit453172bdf93c11f3d0940a083cfcfd1ab0ccfa52 (patch)
treeb38b87d97a958f7847da0adc53c6b2b603c7e24d /src
parent08babdb412a87960fe3602e92abf1bf5fe26a8da (diff)
parentc903210f680c3bc9974a5574c7689d4ee229a232 (diff)
downloadrust-453172bdf93c11f3d0940a083cfcfd1ab0ccfa52.tar.gz
rust-453172bdf93c11f3d0940a083cfcfd1ab0ccfa52.zip
Auto merge of #38713 - clarcharr:trusted_len, r=brson
TrustedLen for Empty and Once.

These implementations were missing, so, I went ahead and added them.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/iter/sources.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs
index da346eaf1db..b988ce73bde 100644
--- a/src/libcore/iter/sources.rs
+++ b/src/libcore/iter/sources.rs
@@ -12,7 +12,7 @@ use fmt;
 use marker;
 use usize;
 
-use super::FusedIterator;
+use super::{FusedIterator, TrustedLen};
 
 /// An iterator that repeats an element endlessly.
 ///
@@ -138,6 +138,9 @@ impl<T> ExactSizeIterator for Empty<T> {
     }
 }
 
+#[unstable(feature = "trusted_len", issue = "37572")]
+unsafe impl<T> TrustedLen for Empty<T> {}
+
 #[unstable(feature = "fused", issue = "35602")]
 impl<T> FusedIterator for Empty<T> {}
 
@@ -216,6 +219,9 @@ impl<T> ExactSizeIterator for Once<T> {
     }
 }
 
+#[unstable(feature = "trusted_len", issue = "37572")]
+unsafe impl<T> TrustedLen for Once<T> {}
+
 #[unstable(feature = "fused", issue = "35602")]
 impl<T> FusedIterator for Once<T> {}