about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/core/src/iter/adapters/array_chunks.rs11
-rw-r--r--library/core/tests/iter/adapters/array_chunks.rs2
2 files changed, 3 insertions, 10 deletions
diff --git a/library/core/src/iter/adapters/array_chunks.rs b/library/core/src/iter/adapters/array_chunks.rs
index e25a6f9754b..c2de5efed1a 100644
--- a/library/core/src/iter/adapters/array_chunks.rs
+++ b/library/core/src/iter/adapters/array_chunks.rs
@@ -1,5 +1,5 @@
 use crate::array;
-use crate::iter::{Fuse, FusedIterator, Iterator, TrustedLen};
+use crate::iter::{Fuse, FusedIterator, Iterator};
 use crate::mem;
 use crate::mem::MaybeUninit;
 use crate::ops::{ControlFlow, Try};
@@ -54,11 +54,7 @@ where
     #[inline]
     fn size_hint(&self) -> (usize, Option<usize>) {
         let (lower, upper) = self.iter.size_hint();
-        // Keep infinite iterator size hint lower bound as `usize::MAX`. This
-        // is required to implement `TrustedLen`.
-        if lower == usize::MAX {
-            return (lower, upper);
-        }
+
         (lower / N, upper.map(|n| n / N))
     }
 
@@ -318,6 +314,3 @@ where
         self.iter.len() / N == 0
     }
 }
-
-#[unstable(feature = "trusted_len", issue = "37572")]
-unsafe impl<I, const N: usize> TrustedLen for ArrayChunks<I, N> where I: TrustedLen {}
diff --git a/library/core/tests/iter/adapters/array_chunks.rs b/library/core/tests/iter/adapters/array_chunks.rs
index dbcfd456028..4e9d89e1e58 100644
--- a/library/core/tests/iter/adapters/array_chunks.rs
+++ b/library/core/tests/iter/adapters/array_chunks.rs
@@ -50,7 +50,7 @@ fn test_iterator_array_chunks_size_hint() {
     assert_eq!(it.size_hint(), (0, Some(0)));
 
     let it = (1..).array_chunks::<2>();
-    assert_eq!(it.size_hint(), (usize::MAX, None));
+    assert_eq!(it.size_hint(), (usize::MAX / 2, None));
 
     let it = (1..).filter(|x| x % 2 != 0).array_chunks::<2>();
     assert_eq!(it.size_hint(), (0, None));