diff options
| author | Igor Gutorov <igootorov@gmail.com> | 2023-06-14 22:40:23 +0300 |
|---|---|---|
| committer | Igor Gutorov <igootorov@gmail.com> | 2023-06-18 06:09:09 +0300 |
| commit | ed82c055c6f2026220cccc6e2202952b670c64c2 (patch) | |
| tree | 8c5950592af1a4f8e88cc032aedeadd979515c89 | |
| parent | fa8762b7b6c2b75d6c83fb011ee8fa4874168829 (diff) | |
| download | rust-ed82c055c6f2026220cccc6e2202952b670c64c2.tar.gz rust-ed82c055c6f2026220cccc6e2202952b670c64c2.zip | |
alloc: Implement PartialOrd for `Vec`s over different allocators
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index d89cdff8e36..a1e88d18709 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2972,9 +2972,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) } } |
