From 2ea4f2df59e1bb60ebfa2b8c81edd1c26ac20ac1 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Wed, 12 Aug 2026 09:35:30 -0700 Subject: [PATCH] Forward all array `PartialOrd` to slices --- library/core/src/array/mod.rs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 63a99349d7c9a..30af6450d19a9 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -410,23 +410,41 @@ where const impl PartialOrd for [T; N] { #[inline] fn partial_cmp(&self, other: &[T; N]) -> Option { - PartialOrd::partial_cmp(&&self[..], &&other[..]) + <[T] as PartialOrd>::partial_cmp(self, other) } + #[inline] fn lt(&self, other: &[T; N]) -> bool { - PartialOrd::lt(&&self[..], &&other[..]) + <[T] as PartialOrd>::lt(self, other) } #[inline] fn le(&self, other: &[T; N]) -> bool { - PartialOrd::le(&&self[..], &&other[..]) + <[T] as PartialOrd>::le(self, other) } #[inline] fn ge(&self, other: &[T; N]) -> bool { - PartialOrd::ge(&&self[..], &&other[..]) + <[T] as PartialOrd>::ge(self, other) } #[inline] fn gt(&self, other: &[T; N]) -> bool { - PartialOrd::gt(&&self[..], &&other[..]) + <[T] as PartialOrd>::gt(self, other) + } + + #[inline] + fn __chaining_lt(&self, other: &[T; N]) -> ControlFlow { + <[T] as PartialOrd>::__chaining_lt(self, other) + } + #[inline] + fn __chaining_le(&self, other: &[T; N]) -> ControlFlow { + <[T] as PartialOrd>::__chaining_le(self, other) + } + #[inline] + fn __chaining_ge(&self, other: &[T; N]) -> ControlFlow { + <[T] as PartialOrd>::__chaining_ge(self, other) + } + #[inline] + fn __chaining_gt(&self, other: &[T; N]) -> ControlFlow { + <[T] as PartialOrd>::__chaining_gt(self, other) } }