Skip to content

Commit ed82c05

Browse files
committed
alloc: Implement PartialOrd for Vecs over different allocators
1 parent fa8762b commit ed82c05

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

library/alloc/src/vec/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -2972,9 +2972,14 @@ impl<'a, T: Copy + 'a, A: Allocator + 'a> Extend<&'a T> for Vec<T, A> {
29722972

29732973
/// Implements comparison of vectors, [lexicographically](Ord#lexicographical-comparison).
29742974
#[stable(feature = "rust1", since = "1.0.0")]
2975-
impl<T: PartialOrd, A: Allocator> PartialOrd for Vec<T, A> {
2975+
impl<T, A1, A2> PartialOrd<Vec<T, A2>> for Vec<T, A1>
2976+
where
2977+
T: PartialOrd,
2978+
A1: Allocator,
2979+
A2: Allocator,
2980+
{
29762981
#[inline]
2977-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
2982+
fn partial_cmp(&self, other: &Vec<T, A2>) -> Option<Ordering> {
29782983
PartialOrd::partial_cmp(&**self, &**other)
29792984
}
29802985
}

0 commit comments

Comments
 (0)