Skip to content

Commit

Permalink
Add PartialEq impls for Vec <-> slice
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Aug 27, 2020
1 parent 132f5fc commit b4b3839
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions library/alloc/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2398,6 +2398,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")] }
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,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);
Expand Down Expand Up @@ -1626,4 +1626,5 @@ 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[..]);
}

0 comments on commit b4b3839

Please sign in to comment.