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