1
1
use crate :: cmp:: BytewiseEq ;
2
2
3
3
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
4
- impl < T , U , const N : usize > PartialEq < [ U ; N ] > for [ T ; N ]
4
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
5
+ impl < T , U , const N : usize > const PartialEq < [ U ; N ] > for [ T ; N ]
5
6
where
6
- T : PartialEq < U > ,
7
+ T : [ const ] PartialEq < U > ,
7
8
{
8
9
#[ inline]
9
10
fn eq ( & self , other : & [ U ; N ] ) -> bool {
@@ -122,14 +123,17 @@ where
122
123
// __impl_slice_eq2! { [A; $N], &'b mut [B; $N] }
123
124
124
125
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
125
- impl < T : Eq , const N : usize > Eq for [ T ; N ] { }
126
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
127
+ impl < T : [ const ] Eq , const N : usize > const Eq for [ T ; N ] { }
126
128
127
- trait SpecArrayEq < Other , const N : usize > : Sized {
129
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
130
+ const trait SpecArrayEq <Other , const N : usize >: Sized {
128
131
fn spec_eq ( a : & [ Self ; N ] , b : & [ Other ; N ] ) -> bool ;
129
132
fn spec_ne ( a : & [ Self ; N ] , b : & [ Other ; N ] ) -> bool ;
130
133
}
131
134
132
- impl < T : PartialEq < Other > , Other , const N : usize > SpecArrayEq < Other , N > for T {
135
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
136
+ impl < T : [ const ] PartialEq < Other > , Other , const N : usize > const SpecArrayEq < Other , N > for T {
133
137
default fn spec_eq ( a : & [ Self ; N ] , b : & [ Other ; N ] ) -> bool {
134
138
a[ ..] == b[ ..]
135
139
}
@@ -138,7 +142,8 @@ impl<T: PartialEq<Other>, Other, const N: usize> SpecArrayEq<Other, N> for T {
138
142
}
139
143
}
140
144
141
- impl < T : BytewiseEq < U > , U , const N : usize > SpecArrayEq < U , N > for T {
145
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
146
+ impl < T : [ const ] BytewiseEq < U > , U , const N : usize > const SpecArrayEq < U , N > for T {
142
147
fn spec_eq ( a : & [ T ; N ] , b : & [ U ; N ] ) -> bool {
143
148
// SAFETY: Arrays are compared element-wise, and don't add any padding
144
149
// between elements, so when the elements are `BytewiseEq`, we can
0 commit comments