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 {
16
17
}
17
18
18
19
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
19
- impl < T , U , const N : usize > PartialEq < [ U ] > for [ T ; N ]
20
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
21
+ impl < T , U , const N : usize > const PartialEq < [ U ] > for [ T ; N ]
20
22
where
21
- T : PartialEq < U > ,
23
+ T : [ const ] PartialEq < U > ,
22
24
{
23
25
#[ inline]
24
26
fn eq ( & self , other : & [ U ] ) -> bool {
37
39
}
38
40
39
41
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40
- impl < T , U , const N : usize > PartialEq < [ U ; N ] > for [ T ]
42
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
43
+ impl < T , U , const N : usize > const PartialEq < [ U ; N ] > for [ T ]
41
44
where
42
- T : PartialEq < U > ,
45
+ T : [ const ] PartialEq < U > ,
43
46
{
44
47
#[ inline]
45
48
fn eq ( & self , other : & [ U ; N ] ) -> bool {
58
61
}
59
62
60
63
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
61
- impl < T , U , const N : usize > PartialEq < & [ U ] > for [ T ; N ]
64
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
65
+ impl < T , U , const N : usize > const PartialEq < & [ U ] > for [ T ; N ]
62
66
where
63
- T : PartialEq < U > ,
67
+ T : [ const ] PartialEq < U > ,
64
68
{
65
69
#[ inline]
66
70
fn eq ( & self , other : & & [ U ] ) -> bool {
73
77
}
74
78
75
79
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
76
- impl < T , U , const N : usize > PartialEq < [ U ; N ] > for & [ T ]
80
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
81
+ impl < T , U , const N : usize > const PartialEq < [ U ; N ] > for & [ T ]
77
82
where
78
- T : PartialEq < U > ,
83
+ T : [ const ] PartialEq < U > ,
79
84
{
80
85
#[ inline]
81
86
fn eq ( & self , other : & [ U ; N ] ) -> bool {
88
93
}
89
94
90
95
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
91
- impl < T , U , const N : usize > PartialEq < & mut [ U ] > for [ T ; N ]
96
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
97
+ impl < T , U , const N : usize > const PartialEq < & mut [ U ] > for [ T ; N ]
92
98
where
93
- T : PartialEq < U > ,
99
+ T : [ const ] PartialEq < U > ,
94
100
{
95
101
#[ inline]
96
102
fn eq ( & self , other : & & mut [ U ] ) -> bool {
@@ -103,9 +109,10 @@ where
103
109
}
104
110
105
111
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
106
- impl < T , U , const N : usize > PartialEq < [ U ; N ] > for & mut [ T ]
112
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
113
+ impl < T , U , const N : usize > const PartialEq < [ U ; N ] > for & mut [ T ]
107
114
where
108
- T : PartialEq < U > ,
115
+ T : [ const ] PartialEq < U > ,
109
116
{
110
117
#[ inline]
111
118
fn eq ( & self , other : & [ U ; N ] ) -> bool {
@@ -122,14 +129,18 @@ where
122
129
// __impl_slice_eq2! { [A; $N], &'b mut [B; $N] }
123
130
124
131
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
125
- impl < T : Eq , const N : usize > Eq for [ T ; N ] { }
132
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
133
+ impl < T : [ const ] Eq , const N : usize > const Eq for [ T ; N ] { }
126
134
135
+ #[ const_trait]
136
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
127
137
trait SpecArrayEq < Other , const N : usize > : Sized {
128
138
fn spec_eq ( a : & [ Self ; N ] , b : & [ Other ; N ] ) -> bool ;
129
139
fn spec_ne ( a : & [ Self ; N ] , b : & [ Other ; N ] ) -> bool ;
130
140
}
131
141
132
- impl < T : PartialEq < Other > , Other , const N : usize > SpecArrayEq < Other , N > for T {
142
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
143
+ impl < T : [ const ] PartialEq < Other > , Other , const N : usize > const SpecArrayEq < Other , N > for T {
133
144
default fn spec_eq ( a : & [ Self ; N ] , b : & [ Other ; N ] ) -> bool {
134
145
a[ ..] == b[ ..]
135
146
}
@@ -138,7 +149,8 @@ impl<T: PartialEq<Other>, Other, const N: usize> SpecArrayEq<Other, N> for T {
138
149
}
139
150
}
140
151
141
- impl < T : BytewiseEq < U > , U , const N : usize > SpecArrayEq < U , N > for T {
152
+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
153
+ impl < T : [ const ] BytewiseEq < U > , U , const N : usize > const SpecArrayEq < U , N > for T {
142
154
fn spec_eq ( a : & [ T ; N ] , b : & [ U ; N ] ) -> bool {
143
155
// SAFETY: Arrays are compared element-wise, and don't add any padding
144
156
// between elements, so when the elements are `BytewiseEq`, we can
0 commit comments