Skip to content

Commit 453172b

Browse files
committed
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.
2 parents 08babdb + c903210 commit 453172b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libcore/iter/sources.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use fmt;
1212
use marker;
1313
use usize;
1414

15-
use super::FusedIterator;
15+
use super::{FusedIterator, TrustedLen};
1616

1717
/// An iterator that repeats an element endlessly.
1818
///
@@ -138,6 +138,9 @@ impl<T> ExactSizeIterator for Empty<T> {
138138
}
139139
}
140140

141+
#[unstable(feature = "trusted_len", issue = "37572")]
142+
unsafe impl<T> TrustedLen for Empty<T> {}
143+
141144
#[unstable(feature = "fused", issue = "35602")]
142145
impl<T> FusedIterator for Empty<T> {}
143146

@@ -216,6 +219,9 @@ impl<T> ExactSizeIterator for Once<T> {
216219
}
217220
}
218221

222+
#[unstable(feature = "trusted_len", issue = "37572")]
223+
unsafe impl<T> TrustedLen for Once<T> {}
224+
219225
#[unstable(feature = "fused", issue = "35602")]
220226
impl<T> FusedIterator for Once<T> {}
221227

0 commit comments

Comments
 (0)