Skip to content

Commit 0c8360a

Browse files
committed
constify comparison traits on arrays
1 parent 2dc7479 commit 0c8360a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

library/core/src/array/equality.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ where
132132
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
133133
impl<T: [const] Eq, const N: usize> const Eq for [T; N] {}
134134

135-
#[const_trait]
136135
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
137-
trait SpecArrayEq<Other, const N: usize>: Sized {
136+
const trait SpecArrayEq<Other, const N: usize>: Sized {
138137
fn spec_eq(a: &[Self; N], b: &[Other; N]) -> bool;
139138
fn spec_ne(a: &[Self; N], b: &[Other; N]) -> bool;
140139
}

library/core/src/array/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ where
403403

404404
/// Implements comparison of arrays [lexicographically](Ord#lexicographical-comparison).
405405
#[stable(feature = "rust1", since = "1.0.0")]
406-
impl<T: PartialOrd, const N: usize> PartialOrd for [T; N] {
406+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
407+
impl<T: [const] PartialOrd, const N: usize> const PartialOrd for [T; N] {
407408
#[inline]
408409
fn partial_cmp(&self, other: &[T; N]) -> Option<Ordering> {
409410
PartialOrd::partial_cmp(&&self[..], &&other[..])
@@ -428,7 +429,8 @@ impl<T: PartialOrd, const N: usize> PartialOrd for [T; N] {
428429

429430
/// Implements comparison of arrays [lexicographically](Ord#lexicographical-comparison).
430431
#[stable(feature = "rust1", since = "1.0.0")]
431-
impl<T: Ord, const N: usize> Ord for [T; N] {
432+
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
433+
impl<T: [const] Ord, const N: usize> const Ord for [T; N] {
432434
#[inline]
433435
fn cmp(&self, other: &[T; N]) -> Ordering {
434436
Ord::cmp(&&self[..], &&other[..])

0 commit comments

Comments
 (0)