about summary refs log tree commit diff
path: root/library/alloc/src/vec/mod.rs
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-06-21 07:37:00 +0200
committerGitHub <noreply@github.com>2023-06-21 07:37:00 +0200
commit78a90cb4ee8a29d6dda00d0b79373daa38e29f17 (patch)
tree18435d95d4d20270492df6342e20ed32e4074998 /library/alloc/src/vec/mod.rs
parentc55d1ee8d4e3162187214692229a63c2cc5e0f31 (diff)
parented82c055c6f2026220cccc6e2202952b670c64c2 (diff)
downloadrust-78a90cb4ee8a29d6dda00d0b79373daa38e29f17.tar.gz
rust-78a90cb4ee8a29d6dda00d0b79373daa38e29f17.zip
Rollup merge of #112632 - gootorov:vec_alloc_partialeq, r=dtolnay
Implement PartialOrd for `Vec`s over different allocators

It is already possible to `PartialEq` `Vec`s with different allocators, but that is not the case with `PartialOrd`.
Diffstat (limited to 'library/alloc/src/vec/mod.rs')
-rw-r--r--library/alloc/src/vec/mod.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index 289bbc7d2ef..a30c6a44e07 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -2978,9 +2978,14 @@ impl<'a, T: Copy + 'a, A: Allocator + 'a> Extend<&'a T> for Vec<T, A> {
 
 /// Implements comparison of vectors, [lexicographically](Ord#lexicographical-comparison).
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: PartialOrd, A: Allocator> PartialOrd for Vec<T, A> {
+impl<T, A1, A2> PartialOrd<Vec<T, A2>> for Vec<T, A1>
+where
+    T: PartialOrd,
+    A1: Allocator,
+    A2: Allocator,
+{
     #[inline]
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+    fn partial_cmp(&self, other: &Vec<T, A2>) -> Option<Ordering> {
         PartialOrd::partial_cmp(&**self, &**other)
     }
 }