|
145 | 145 |
|
146 | 146 | #![stable(feature = "rust1", since = "1.0.0")] |
147 | 147 |
|
148 | | -use iter::{FromIterator, FusedIterator}; |
| 148 | +use iter::{FromIterator, FusedIterator, TrustedLen}; |
149 | 149 | use mem; |
150 | 150 |
|
151 | 151 | // Note that this is not a lang item per se, but it has a hidden dependency on |
@@ -803,6 +803,7 @@ impl<A> DoubleEndedIterator for Item<A> { |
803 | 803 |
|
804 | 804 | impl<A> ExactSizeIterator for Item<A> {} |
805 | 805 | impl<A> FusedIterator for Item<A> {} |
| 806 | +unsafe impl<A> TrustedLen for Item<A> {} |
806 | 807 |
|
807 | 808 | /// An iterator over a reference of the contained item in an [`Option`]. |
808 | 809 | /// |
@@ -833,6 +834,9 @@ impl<'a, A> ExactSizeIterator for Iter<'a, A> {} |
833 | 834 | #[unstable(feature = "fused", issue = "35602")] |
834 | 835 | impl<'a, A> FusedIterator for Iter<'a, A> {} |
835 | 836 |
|
| 837 | +#[unstable(feature = "trusted_len", issue = "0")] |
| 838 | +unsafe impl<'a, A> TrustedLen for Iter<'a, A> {} |
| 839 | + |
836 | 840 | #[stable(feature = "rust1", since = "1.0.0")] |
837 | 841 | impl<'a, A> Clone for Iter<'a, A> { |
838 | 842 | fn clone(&self) -> Iter<'a, A> { |
@@ -868,6 +872,8 @@ impl<'a, A> ExactSizeIterator for IterMut<'a, A> {} |
868 | 872 |
|
869 | 873 | #[unstable(feature = "fused", issue = "35602")] |
870 | 874 | impl<'a, A> FusedIterator for IterMut<'a, A> {} |
| 875 | +#[unstable(feature = "trusted_len", issue = "0")] |
| 876 | +unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {} |
871 | 877 |
|
872 | 878 | /// An iterator over the item contained inside an [`Option`]. |
873 | 879 | /// |
@@ -898,6 +904,9 @@ impl<A> ExactSizeIterator for IntoIter<A> {} |
898 | 904 | #[unstable(feature = "fused", issue = "35602")] |
899 | 905 | impl<A> FusedIterator for IntoIter<A> {} |
900 | 906 |
|
| 907 | +#[unstable(feature = "trusted_len", issue = "0")] |
| 908 | +unsafe impl<A> TrustedLen for IntoIter<A> {} |
| 909 | + |
901 | 910 | ///////////////////////////////////////////////////////////////////////////// |
902 | 911 | // FromIterator |
903 | 912 | ///////////////////////////////////////////////////////////////////////////// |
|
0 commit comments