diff options
| author | bors <bors@rust-lang.org> | 2020-10-07 01:20:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-07 01:20:11 +0000 |
| commit | 5779815f896fa6e21c04a5efb378aa6ba009a471 (patch) | |
| tree | 2d6407177968a53ea460e74e83e3b99a49392bff | |
| parent | 59dafb876e125c49fca93820c5ef22da3fcb8644 (diff) | |
| parent | b4b383981abac7ca8aa180c7ae3e28876615b887 (diff) | |
| download | rust-5779815f896fa6e21c04a5efb378aa6ba009a471.tar.gz rust-5779815f896fa6e21c04a5efb378aa6ba009a471.zip | |
Auto merge of #74194 - mbrubeck:slice-eq, r=sfackler
Add PartialEq impls for Vec <-> slice
This is a follow-up to #71660 and rust-lang/rfcs#2917 to add two more missing vec/slice PartialEq impls:
```
impl<A, B> PartialEq<[B]> for Vec<A> where A: PartialEq<B> { .. }
impl<A, B> PartialEq<Vec<B>> for [A] where A: PartialEq<B> { .. }
```
Since this is insta-stable, it should go through the `@rust-lang/libs` FCP process. Note that I used version 1.47.0 for the `stable` attribute because I assume this will not merge before the 1.46.0 branch is cut next week.
| -rw-r--r-- | library/alloc/src/vec.rs | 2 | ||||
| -rw-r--r-- | library/alloc/tests/vec.rs | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index b20ccd388d1..e8e52299d0b 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -2591,6 +2591,8 @@ __impl_slice_eq1! { [] Vec<A>, &[B], #[stable(feature = "rust1", since = "1.0.0" __impl_slice_eq1! { [] Vec<A>, &mut [B], #[stable(feature = "rust1", since = "1.0.0")] } __impl_slice_eq1! { [] &[A], Vec<B>, #[stable(feature = "partialeq_vec_for_ref_slice", since = "1.46.0")] } __impl_slice_eq1! { [] &mut [A], Vec<B>, #[stable(feature = "partialeq_vec_for_ref_slice", since = "1.46.0")] } +__impl_slice_eq1! { [] Vec<A>, [B], #[stable(feature = "partialeq_vec_for_slice", since = "1.48.0")] } +__impl_slice_eq1! { [] [A], Vec<B>, #[stable(feature = "partialeq_vec_for_slice", since = "1.48.0")] } __impl_slice_eq1! { [] Cow<'_, [A]>, Vec<B> where A: Clone, #[stable(feature = "rust1", since = "1.0.0")] } __impl_slice_eq1! { [] Cow<'_, [A]>, &[B] where A: Clone, #[stable(feature = "rust1", since = "1.0.0")] } __impl_slice_eq1! { [] Cow<'_, [A]>, &mut [B] where A: Clone, #[stable(feature = "rust1", since = "1.0.0")] } diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs index b7c7138db4f..771a293b8e5 100644 --- a/library/alloc/tests/vec.rs +++ b/library/alloc/tests/vec.rs @@ -1799,7 +1799,7 @@ fn partialeq_vec_and_prim() { } macro_rules! assert_partial_eq_valid { - ($a2:ident, $a3:ident; $b2:ident, $b3: ident) => { + ($a2:expr, $a3:expr; $b2:expr, $b3: expr) => { assert!($a2 == $b2); assert!($a2 != $b3); assert!($a3 != $b2); @@ -1831,6 +1831,7 @@ fn partialeq_vec_full() { assert_partial_eq_valid!(slicemut2,slicemut3; vec2,vec3); assert_partial_eq_valid!(vec2,vec3; array2,array3); assert_partial_eq_valid!(vec2,vec3; arrayref2,arrayref3); + assert_partial_eq_valid!(vec2,vec3; arrayref2[..],arrayref3[..]); } #[test] |
