about summary refs log tree commit diff
path: root/library/alloc/src/vec
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-28 04:12:10 +0200
committerGitHub <noreply@github.com>2022-03-28 04:12:10 +0200
commit6ed1a67b3805bdea306ee055e035e298f92a10e4 (patch)
tree2e2eb724df2176450ce165dd2d94464e99e60083 /library/alloc/src/vec
parent9412316ac39db2a91284d809e2ada9c69afe5b50 (diff)
parentee23fd2ca36e82ff7455520705566a04274d3700 (diff)
downloadrust-6ed1a67b3805bdea306ee055e035e298f92a10e4.tar.gz
rust-6ed1a67b3805bdea306ee055e035e298f92a10e4.zip
Rollup merge of #93755 - ChayimFriedman2:allow-comparing-vecs-with-different-allocators, r=dtolnay
Allow comparing `Vec`s with different allocators using `==`

See https://stackoverflow.com/q/71021633/7884305.

I did not changed the `PartialOrd` impl too because it was not generic already (didn't support `Vec<T> <=> Vec<U> where T: PartialOrd<U>`).

Does it needs tests?

I don't think this will hurt type inference much because the default allocator is usually not inferred (`new()` specifies it directly, and even with other allocators, you pass the allocator to `new_in()` so the compiler usually knows the type).

I think this requires FCP since the impls are already stable.
Diffstat (limited to 'library/alloc/src/vec')
-rw-r--r--library/alloc/src/vec/partial_eq.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/alloc/src/vec/partial_eq.rs b/library/alloc/src/vec/partial_eq.rs
index 50e14096105..b0cf72577a1 100644
--- a/library/alloc/src/vec/partial_eq.rs
+++ b/library/alloc/src/vec/partial_eq.rs
@@ -20,7 +20,7 @@ macro_rules! __impl_slice_eq1 {
     }
 }
 
-__impl_slice_eq1! { [A: Allocator] Vec<T, A>, Vec<U, A>, #[stable(feature = "rust1", since = "1.0.0")] }
+__impl_slice_eq1! { [A1: Allocator, A2: Allocator] Vec<T, A1>, Vec<U, A2>, #[stable(feature = "rust1", since = "1.0.0")] }
 __impl_slice_eq1! { [A: Allocator] Vec<T, A>, &[U], #[stable(feature = "rust1", since = "1.0.0")] }
 __impl_slice_eq1! { [A: Allocator] Vec<T, A>, &mut [U], #[stable(feature = "rust1", since = "1.0.0")] }
 __impl_slice_eq1! { [A: Allocator] &[T], Vec<U, A>, #[stable(feature = "partialeq_vec_for_ref_slice", since = "1.46.0")] }