@@ -114,139 +114,159 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> {
114
114
ty:: TyChar => {
115
115
self . check_primitive_impl ( def_id,
116
116
lang_items. char_impl ( ) ,
117
+ None ,
117
118
"char" ,
118
119
"char" ,
119
120
item. span ) ;
120
121
}
121
122
ty:: TyStr => {
122
123
self . check_primitive_impl ( def_id,
123
124
lang_items. str_impl ( ) ,
125
+ None ,
124
126
"str" ,
125
127
"str" ,
126
128
item. span ) ;
127
129
}
128
130
ty:: TySlice ( slice_item) if slice_item == self . tcx . types . u8 => {
129
131
self . check_primitive_impl ( def_id,
130
132
lang_items. slice_u8_impl ( ) ,
133
+ lang_items. slice_u8_alloc_impl ( ) ,
131
134
"slice_u8" ,
132
135
"[u8]" ,
133
136
item. span ) ;
134
137
}
135
138
ty:: TySlice ( _) => {
136
139
self . check_primitive_impl ( def_id,
137
140
lang_items. slice_impl ( ) ,
141
+ None ,
138
142
"slice" ,
139
143
"[T]" ,
140
144
item. span ) ;
141
145
}
142
146
ty:: TyRawPtr ( ty:: TypeAndMut { ty : _, mutbl : hir:: MutImmutable } ) => {
143
147
self . check_primitive_impl ( def_id,
144
148
lang_items. const_ptr_impl ( ) ,
149
+ None ,
145
150
"const_ptr" ,
146
151
"*const T" ,
147
152
item. span ) ;
148
153
}
149
154
ty:: TyRawPtr ( ty:: TypeAndMut { ty : _, mutbl : hir:: MutMutable } ) => {
150
155
self . check_primitive_impl ( def_id,
151
156
lang_items. mut_ptr_impl ( ) ,
157
+ None ,
152
158
"mut_ptr" ,
153
159
"*mut T" ,
154
160
item. span ) ;
155
161
}
156
162
ty:: TyInt ( ast:: IntTy :: I8 ) => {
157
163
self . check_primitive_impl ( def_id,
158
164
lang_items. i8_impl ( ) ,
165
+ None ,
159
166
"i8" ,
160
167
"i8" ,
161
168
item. span ) ;
162
169
}
163
170
ty:: TyInt ( ast:: IntTy :: I16 ) => {
164
171
self . check_primitive_impl ( def_id,
165
172
lang_items. i16_impl ( ) ,
173
+ None ,
166
174
"i16" ,
167
175
"i16" ,
168
176
item. span ) ;
169
177
}
170
178
ty:: TyInt ( ast:: IntTy :: I32 ) => {
171
179
self . check_primitive_impl ( def_id,
172
180
lang_items. i32_impl ( ) ,
181
+ None ,
173
182
"i32" ,
174
183
"i32" ,
175
184
item. span ) ;
176
185
}
177
186
ty:: TyInt ( ast:: IntTy :: I64 ) => {
178
187
self . check_primitive_impl ( def_id,
179
188
lang_items. i64_impl ( ) ,
189
+ None ,
180
190
"i64" ,
181
191
"i64" ,
182
192
item. span ) ;
183
193
}
184
194
ty:: TyInt ( ast:: IntTy :: I128 ) => {
185
195
self . check_primitive_impl ( def_id,
186
196
lang_items. i128_impl ( ) ,
197
+ None ,
187
198
"i128" ,
188
199
"i128" ,
189
200
item. span ) ;
190
201
}
191
202
ty:: TyInt ( ast:: IntTy :: Isize ) => {
192
203
self . check_primitive_impl ( def_id,
193
204
lang_items. isize_impl ( ) ,
205
+ None ,
194
206
"isize" ,
195
207
"isize" ,
196
208
item. span ) ;
197
209
}
198
210
ty:: TyUint ( ast:: UintTy :: U8 ) => {
199
211
self . check_primitive_impl ( def_id,
200
212
lang_items. u8_impl ( ) ,
213
+ None ,
201
214
"u8" ,
202
215
"u8" ,
203
216
item. span ) ;
204
217
}
205
218
ty:: TyUint ( ast:: UintTy :: U16 ) => {
206
219
self . check_primitive_impl ( def_id,
207
220
lang_items. u16_impl ( ) ,
221
+ None ,
208
222
"u16" ,
209
223
"u16" ,
210
224
item. span ) ;
211
225
}
212
226
ty:: TyUint ( ast:: UintTy :: U32 ) => {
213
227
self . check_primitive_impl ( def_id,
214
228
lang_items. u32_impl ( ) ,
229
+ None ,
215
230
"u32" ,
216
231
"u32" ,
217
232
item. span ) ;
218
233
}
219
234
ty:: TyUint ( ast:: UintTy :: U64 ) => {
220
235
self . check_primitive_impl ( def_id,
221
236
lang_items. u64_impl ( ) ,
237
+ None ,
222
238
"u64" ,
223
239
"u64" ,
224
240
item. span ) ;
225
241
}
226
242
ty:: TyUint ( ast:: UintTy :: U128 ) => {
227
243
self . check_primitive_impl ( def_id,
228
244
lang_items. u128_impl ( ) ,
245
+ None ,
229
246
"u128" ,
230
247
"u128" ,
231
248
item. span ) ;
232
249
}
233
250
ty:: TyUint ( ast:: UintTy :: Usize ) => {
234
251
self . check_primitive_impl ( def_id,
235
252
lang_items. usize_impl ( ) ,
253
+ None ,
236
254
"usize" ,
237
255
"usize" ,
238
256
item. span ) ;
239
257
}
240
258
ty:: TyFloat ( ast:: FloatTy :: F32 ) => {
241
259
self . check_primitive_impl ( def_id,
242
260
lang_items. f32_impl ( ) ,
261
+ None ,
243
262
"f32" ,
244
263
"f32" ,
245
264
item. span ) ;
246
265
}
247
266
ty:: TyFloat ( ast:: FloatTy :: F64 ) => {
248
267
self . check_primitive_impl ( def_id,
249
268
lang_items. f64_impl ( ) ,
269
+ None ,
250
270
"f64" ,
251
271
"f64" ,
252
272
item. span ) ;
@@ -305,11 +325,15 @@ impl<'a, 'tcx> InherentCollect<'a, 'tcx> {
305
325
fn check_primitive_impl ( & self ,
306
326
impl_def_id : DefId ,
307
327
lang_def_id : Option < DefId > ,
328
+ lang_def_id2 : Option < DefId > ,
308
329
lang : & str ,
309
330
ty : & str ,
310
331
span : Span ) {
311
- match lang_def_id {
312
- Some ( lang_def_id) if lang_def_id == impl_def_id => {
332
+ match ( lang_def_id, lang_def_id2) {
333
+ ( Some ( lang_def_id) , _) if lang_def_id == impl_def_id => {
334
+ // OK
335
+ }
336
+ ( _, Some ( lang_def_id) ) if lang_def_id == impl_def_id => {
313
337
// OK
314
338
}
315
339
_ => {
0 commit comments