From c903210f680c3bc9974a5574c7689d4ee229a232 Mon Sep 17 00:00:00 2001 From: Clar Charr Date: Fri, 30 Dec 2016 14:34:47 -0500 Subject: [PATCH] TrustedLen for Empty and Once. --- src/libcore/iter/sources.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 ExactSizeIterator for Empty { } } +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Empty {} + #[unstable(feature = "fused", issue = "35602")] impl FusedIterator for Empty {} @@ -216,6 +219,9 @@ impl ExactSizeIterator for Once { } } +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Once {} + #[unstable(feature = "fused", issue = "35602")] impl FusedIterator for Once {}