From 910c7fa7673b80ead337c5d37259c9ff4dcf355c Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Fri, 11 Jun 2021 22:16:44 -0700 Subject: [PATCH] Add doc(hidden) to all __iterator_get_unchecked This method on the Iterator trait is doc(hidden), and about half of implementations were doc(hidden). This adds the attribute to the remaining implementations. --- library/alloc/src/collections/vec_deque/into_iter.rs | 1 + library/alloc/src/collections/vec_deque/iter.rs | 1 + library/alloc/src/collections/vec_deque/iter_mut.rs | 1 + library/alloc/src/vec/into_iter.rs | 1 + library/core/src/array/iter.rs | 1 + library/core/src/iter/adapters/cloned.rs | 1 + library/core/src/iter/adapters/copied.rs | 1 + library/core/src/iter/adapters/enumerate.rs | 1 + library/core/src/iter/adapters/fuse.rs | 1 + library/core/src/iter/adapters/map.rs | 1 + library/core/src/iter/adapters/zip.rs | 1 + library/core/src/iter/range.rs | 1 + library/core/src/slice/iter.rs | 2 ++ library/core/src/str/iter.rs | 1 + 14 files changed, 15 insertions(+) diff --git a/library/alloc/src/collections/vec_deque/into_iter.rs b/library/alloc/src/collections/vec_deque/into_iter.rs index 1c635dd4f27f..46a769a722a8 100644 --- a/library/alloc/src/collections/vec_deque/into_iter.rs +++ b/library/alloc/src/collections/vec_deque/into_iter.rs @@ -38,6 +38,7 @@ impl Iterator for IntoIter { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/alloc/src/collections/vec_deque/iter.rs b/library/alloc/src/collections/vec_deque/iter.rs index f3eb228c9e38..ae1b03c9a4d2 100644 --- a/library/alloc/src/collections/vec_deque/iter.rs +++ b/library/alloc/src/collections/vec_deque/iter.rs @@ -103,6 +103,7 @@ impl<'a, T> Iterator for Iter<'a, T> { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/alloc/src/collections/vec_deque/iter_mut.rs b/library/alloc/src/collections/vec_deque/iter_mut.rs index 9493676e66bc..df30c38652f7 100644 --- a/library/alloc/src/collections/vec_deque/iter_mut.rs +++ b/library/alloc/src/collections/vec_deque/iter_mut.rs @@ -89,6 +89,7 @@ impl<'a, T> Iterator for IterMut<'a, T> { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 8da4d995ba5c..7a08f4c6cbaa 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -163,6 +163,7 @@ impl Iterator for IntoIter { self.len() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/array/iter.rs b/library/core/src/array/iter.rs index aedbeab66105..931ea77eca4d 100644 --- a/library/core/src/array/iter.rs +++ b/library/core/src/array/iter.rs @@ -132,6 +132,7 @@ impl Iterator for IntoIter { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/cloned.rs b/library/core/src/iter/adapters/cloned.rs index 7efc155175c3..5cd65a9415fd 100644 --- a/library/core/src/iter/adapters/cloned.rs +++ b/library/core/src/iter/adapters/cloned.rs @@ -58,6 +58,7 @@ where self.it.map(T::clone).fold(init, f) } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> T where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/copied.rs b/library/core/src/iter/adapters/copied.rs index def240892758..07a3b5d24565 100644 --- a/library/core/src/iter/adapters/copied.rs +++ b/library/core/src/iter/adapters/copied.rs @@ -74,6 +74,7 @@ where self.it.count() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> T where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/enumerate.rs b/library/core/src/iter/adapters/enumerate.rs index 91722a4b62a2..8b27bdc60a70 100644 --- a/library/core/src/iter/adapters/enumerate.rs +++ b/library/core/src/iter/adapters/enumerate.rs @@ -111,6 +111,7 @@ where } #[rustc_inherit_overflow_checks] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> ::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/fuse.rs b/library/core/src/iter/adapters/fuse.rs index aff48b1b220c..0c21df4f12c6 100644 --- a/library/core/src/iter/adapters/fuse.rs +++ b/library/core/src/iter/adapters/fuse.rs @@ -114,6 +114,7 @@ where } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/map.rs b/library/core/src/iter/adapters/map.rs index 0bf9f4b0327e..dc86eccfcb82 100644 --- a/library/core/src/iter/adapters/map.rs +++ b/library/core/src/iter/adapters/map.rs @@ -122,6 +122,7 @@ where self.iter.fold(init, map_fold(self.f, g)) } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> B where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs index c95324c80ba6..8a6955060e82 100644 --- a/library/core/src/iter/adapters/zip.rs +++ b/library/core/src/iter/adapters/zip.rs @@ -88,6 +88,7 @@ where } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/iter/range.rs b/library/core/src/iter/range.rs index de5d77e96ee5..4a86d6a100ab 100644 --- a/library/core/src/iter/range.rs +++ b/library/core/src/iter/range.rs @@ -667,6 +667,7 @@ impl Iterator for ops::Range { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item where Self: TrustedRandomAccess, diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index 1ee662c6c8e3..b2cb2f12bbfe 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -2148,6 +2148,7 @@ impl<'a, T, const N: usize> Iterator for ArrayChunks<'a, T, N> { self.iter.last() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> &'a [T; N] { // SAFETY: The safety guarantees of `__iterator_get_unchecked` are // transferred to the caller. @@ -2260,6 +2261,7 @@ impl<'a, T, const N: usize> Iterator for ArrayChunksMut<'a, T, N> { self.iter.last() } + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> &'a mut [T; N] { // SAFETY: The safety guarantees of `__iterator_get_unchecked` are transferred to // the caller. diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index 6ec6b70b5711..a5774764573b 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -295,6 +295,7 @@ impl Iterator for Bytes<'_> { } #[inline] + #[doc(hidden)] unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> u8 { // SAFETY: the caller must uphold the safety contract // for `Iterator::__iterator_get_unchecked`.