about summary refs log tree commit diff
path: root/src/libcore/array
diff options
context:
space:
mode:
authorRoman Proskuryakov <humbug@deeptown.org>2020-07-05 15:02:01 +0300
committerRoman Proskuryakov <humbug@deeptown.org>2020-07-05 15:47:08 +0300
commiteff62069ad602090e8d27b83cffd9e77479ed4be (patch)
tree6fb5ca35f019a29a7c41ce206d53c17968376c75 /src/libcore/array
parent7d4a92d4f8dc03409984695d78893fffdd3ff1f9 (diff)
downloadrust-eff62069ad602090e8d27b83cffd9e77479ed4be.tar.gz
rust-eff62069ad602090e8d27b83cffd9e77479ed4be.zip
Remove the usage of the LengthAtMost32 trait
Diffstat (limited to 'src/libcore/array')
-rw-r--r--src/libcore/array/iter.rs45
-rw-r--r--src/libcore/array/mod.rs51
2 files changed, 19 insertions, 77 deletions
diff --git a/src/libcore/array/iter.rs b/src/libcore/array/iter.rs
index f6b8d4ba081..174f7e26efb 100644
--- a/src/libcore/array/iter.rs
+++ b/src/libcore/array/iter.rs
@@ -1,6 +1,5 @@
 //! Defines the `IntoIter` owned iterator for arrays.
 
-use super::LengthAtMost32;
 use crate::{
     fmt,
     iter::{ExactSizeIterator, FusedIterator, TrustedLen},
@@ -13,10 +12,7 @@ use crate::{
 ///
 /// [array]: ../../std/primitive.array.html
 #[unstable(feature = "array_value_iter", issue = "65798")]
-pub struct IntoIter<T, const N: usize>
-where
-    [T; N]: LengthAtMost32,
-{
+pub struct IntoIter<T, const N: usize> {
     /// This is the array we are iterating over.
     ///
     /// Elements with index `i` where `alive.start <= i < alive.end` have not
@@ -39,10 +35,7 @@ where
     alive: Range<usize>,
 }
 
-impl<T, const N: usize> IntoIter<T, N>
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T, const N: usize> IntoIter<T, N> {
     /// Creates a new iterator over the given `array`.
     ///
     /// *Note*: this method might never get stabilized and/or removed in the
@@ -99,10 +92,7 @@ where
 }
 
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-impl<T, const N: usize> Iterator for IntoIter<T, N>
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T, const N: usize> Iterator for IntoIter<T, N> {
     type Item = T;
     fn next(&mut self) -> Option<Self::Item> {
         if self.alive.start == self.alive.end {
@@ -146,10 +136,7 @@ where
 }
 
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-impl<T, const N: usize> DoubleEndedIterator for IntoIter<T, N>
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T, const N: usize> DoubleEndedIterator for IntoIter<T, N> {
     fn next_back(&mut self) -> Option<Self::Item> {
         if self.alive.start == self.alive.end {
             return None;
@@ -182,10 +169,7 @@ where
 }
 
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-impl<T, const N: usize> Drop for IntoIter<T, N>
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T, const N: usize> Drop for IntoIter<T, N> {
     fn drop(&mut self) {
         // SAFETY: This is safe: `as_mut_slice` returns exactly the sub-slice
         // of elements that have not been moved out yet and that remain
@@ -195,10 +179,7 @@ where
 }
 
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-impl<T, const N: usize> ExactSizeIterator for IntoIter<T, N>
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T, const N: usize> ExactSizeIterator for IntoIter<T, N> {
     fn len(&self) -> usize {
         // Will never underflow due to the invariant `alive.start <=
         // alive.end`.
@@ -210,20 +191,17 @@ where
 }
 
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-impl<T, const N: usize> FusedIterator for IntoIter<T, N> where [T; N]: LengthAtMost32 {}
+impl<T, const N: usize> FusedIterator for IntoIter<T, N> {}
 
 // The iterator indeed reports the correct length. The number of "alive"
 // elements (that will still be yielded) is the length of the range `alive`.
 // This range is decremented in length in either `next` or `next_back`. It is
 // always decremented by 1 in those methods, but only if `Some(_)` is returned.
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-unsafe impl<T, const N: usize> TrustedLen for IntoIter<T, N> where [T; N]: LengthAtMost32 {}
+unsafe impl<T, const N: usize> TrustedLen for IntoIter<T, N> {}
 
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-impl<T: Clone, const N: usize> Clone for IntoIter<T, N>
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T: Clone, const N: usize> Clone for IntoIter<T, N> {
     fn clone(&self) -> Self {
         // SAFETY: each point of unsafety is documented inside the unsafe block
         unsafe {
@@ -249,10 +227,7 @@ where
 }
 
 #[stable(feature = "array_value_iter_impls", since = "1.40.0")]
-impl<T: fmt::Debug, const N: usize> fmt::Debug for IntoIter<T, N>
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T: fmt::Debug, const N: usize> fmt::Debug for IntoIter<T, N> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // Only print the elements that were not yielded yet: we cannot
         // access the yielded elements anymore.
diff --git a/src/libcore/array/mod.rs b/src/libcore/array/mod.rs
index bf4c3d8a057..c5e7f659485 100644
--- a/src/libcore/array/mod.rs
+++ b/src/libcore/array/mod.rs
@@ -125,7 +125,6 @@ impl<T, const N: usize> BorrowMut<[T]> for [T; N] {
 impl<T, const N: usize> TryFrom<&[T]> for [T; N]
 where
     T: Copy,
-    [T; N]: LengthAtMost32,
 {
     type Error = TryFromSliceError;
 
@@ -135,10 +134,7 @@ where
 }
 
 #[stable(feature = "try_from", since = "1.34.0")]
-impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N] {
     type Error = TryFromSliceError;
 
     fn try_from(slice: &[T]) -> Result<&[T; N], TryFromSliceError> {
@@ -153,10 +149,7 @@ where
 }
 
 #[stable(feature = "try_from", since = "1.34.0")]
-impl<'a, T, const N: usize> TryFrom<&'a mut [T]> for &'a mut [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<'a, T, const N: usize> TryFrom<&'a mut [T]> for &'a mut [T; N] {
     type Error = TryFromSliceError;
 
     fn try_from(slice: &mut [T]) -> Result<&mut [T; N], TryFromSliceError> {
@@ -171,30 +164,21 @@ where
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Hash, const N: usize> Hash for [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T: Hash, const N: usize> Hash for [T; N] {
     fn hash<H: hash::Hasher>(&self, state: &mut H) {
         Hash::hash(&self[..], state)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: fmt::Debug, const N: usize> fmt::Debug for [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T: fmt::Debug, const N: usize> fmt::Debug for [T; N] {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt::Debug::fmt(&&self[..], f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T, const N: usize> IntoIterator for &'a [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<'a, T, const N: usize> IntoIterator for &'a [T; N] {
     type Item = &'a T;
     type IntoIter = Iter<'a, T>;
 
@@ -204,10 +188,7 @@ where
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] {
     type Item = &'a mut T;
     type IntoIter = IterMut<'a, T>;
 
@@ -220,8 +201,6 @@ where
 impl<A, B, const N: usize> PartialEq<[B; N]> for [A; N]
 where
     A: PartialEq<B>,
-    [A; N]: LengthAtMost32,
-    [B; N]: LengthAtMost32,
 {
     #[inline]
     fn eq(&self, other: &[B; N]) -> bool {
@@ -237,7 +216,6 @@ where
 impl<A, B, const N: usize> PartialEq<[B]> for [A; N]
 where
     A: PartialEq<B>,
-    [A; N]: LengthAtMost32,
 {
     #[inline]
     fn eq(&self, other: &[B]) -> bool {
@@ -253,7 +231,6 @@ where
 impl<A, B, const N: usize> PartialEq<[A; N]> for [B]
 where
     B: PartialEq<A>,
-    [A; N]: LengthAtMost32,
 {
     #[inline]
     fn eq(&self, other: &[A; N]) -> bool {
@@ -269,7 +246,6 @@ where
 impl<'b, A, B, const N: usize> PartialEq<&'b [B]> for [A; N]
 where
     A: PartialEq<B>,
-    [A; N]: LengthAtMost32,
 {
     #[inline]
     fn eq(&self, other: &&'b [B]) -> bool {
@@ -285,7 +261,6 @@ where
 impl<'b, A, B, const N: usize> PartialEq<[A; N]> for &'b [B]
 where
     B: PartialEq<A>,
-    [A; N]: LengthAtMost32,
 {
     #[inline]
     fn eq(&self, other: &[A; N]) -> bool {
@@ -301,7 +276,6 @@ where
 impl<'b, A, B, const N: usize> PartialEq<&'b mut [B]> for [A; N]
 where
     A: PartialEq<B>,
-    [A; N]: LengthAtMost32,
 {
     #[inline]
     fn eq(&self, other: &&'b mut [B]) -> bool {
@@ -317,7 +291,6 @@ where
 impl<'b, A, B, const N: usize> PartialEq<[A; N]> for &'b mut [B]
 where
     B: PartialEq<A>,
-    [A; N]: LengthAtMost32,
 {
     #[inline]
     fn eq(&self, other: &[A; N]) -> bool {
@@ -334,13 +307,10 @@ where
 // __impl_slice_eq2! { [A; $N], &'b mut [B; $N] }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Eq, const N: usize> Eq for [T; N] where [T; N]: LengthAtMost32 {}
+impl<T: Eq, const N: usize> Eq for [T; N] {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: PartialOrd, const N: usize> PartialOrd for [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T: PartialOrd, const N: usize> PartialOrd for [T; N] {
     #[inline]
     fn partial_cmp(&self, other: &[T; N]) -> Option<Ordering> {
         PartialOrd::partial_cmp(&&self[..], &&other[..])
@@ -365,10 +335,7 @@ where
 
 /// Implements comparison of arrays lexicographically.
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: Ord, const N: usize> Ord for [T; N]
-where
-    [T; N]: LengthAtMost32,
-{
+impl<T: Ord, const N: usize> Ord for [T; N] {
     #[inline]
     fn cmp(&self, other: &[T; N]) -> Ordering {
         Ord::cmp(&&self[..], &&other[..])