From 4274547ad14f2c3c6cef8b23486ad04729770ef9 Mon Sep 17 00:00:00 2001 From: Jeremy Smart Date: Mon, 17 Nov 2025 20:58:32 -0500 Subject: [PATCH] implement PartialEq> for [T; N] and &[T; N] --- library/alloc/src/vec/partial_eq.rs | 4 ++-- tests/ui/consts/too_generic_eval_ice.current.stderr | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/alloc/src/vec/partial_eq.rs b/library/alloc/src/vec/partial_eq.rs index 5e620c4b2efe7..4e96452660c79 100644 --- a/library/alloc/src/vec/partial_eq.rs +++ b/library/alloc/src/vec/partial_eq.rs @@ -34,12 +34,12 @@ __impl_slice_eq1! { [] Cow<'_, [T]>, &[U] where T: Clone, #[stable(feature = "ru __impl_slice_eq1! { [] Cow<'_, [T]>, &mut [U] where T: Clone, #[stable(feature = "rust1", since = "1.0.0")] } __impl_slice_eq1! { [A: Allocator, const N: usize] Vec, [U; N], #[stable(feature = "rust1", since = "1.0.0")] } __impl_slice_eq1! { [A: Allocator, const N: usize] Vec, &[U; N], #[stable(feature = "rust1", since = "1.0.0")] } +__impl_slice_eq1! { [const N: usize] [T; N], Vec, #[stable(feature = "array_vec_partialeq", since = "CURRENT_RUSTC_VERSION")]} +__impl_slice_eq1! { [const N: usize] &[T; N], Vec, #[stable(feature = "array_vec_partialeq", since = "CURRENT_RUSTC_VERSION")]} // NOTE: some less important impls are omitted to reduce code bloat // FIXME(Centril): Reconsider this? //__impl_slice_eq1! { [const N: usize] Vec, &mut [B; N], } -//__impl_slice_eq1! { [const N: usize] [A; N], Vec, } -//__impl_slice_eq1! { [const N: usize] &[A; N], Vec, } //__impl_slice_eq1! { [const N: usize] &mut [A; N], Vec, } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, [B; N], } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, &[B; N], } diff --git a/tests/ui/consts/too_generic_eval_ice.current.stderr b/tests/ui/consts/too_generic_eval_ice.current.stderr index 02bcaee80154f..00a9d714c273b 100644 --- a/tests/ui/consts/too_generic_eval_ice.current.stderr +++ b/tests/ui/consts/too_generic_eval_ice.current.stderr @@ -30,6 +30,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0] | = help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; Self::HOST_SIZE]` = help: the following other types implement trait `PartialEq`: + `&[T; N]` implements `PartialEq>` `&[T]` implements `PartialEq>` `&[T]` implements `PartialEq<[U; N]>` `&[u8; N]` implements `PartialEq` @@ -37,8 +38,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0] `&[u8]` implements `PartialEq` `&[u8]` implements `PartialEq` `&mut [T]` implements `PartialEq>` - `&mut [T]` implements `PartialEq<[U; N]>` - and 11 others + and 13 others error: aborting due to 4 previous errors