@@ -137,6 +137,8 @@ crate fn assemble_builtin_sized_impls<'tcx>(
137
137
ty:: Int ( ..) |
138
138
ty:: Uint ( ..) |
139
139
ty:: Float ( ..) |
140
+ ty:: Infer ( ty:: IntVar ( _) ) |
141
+ ty:: Infer ( ty:: FloatVar ( _) ) |
140
142
ty:: Error |
141
143
ty:: Never => push_builtin_impl ( ty, & [ ] ) ,
142
144
@@ -188,14 +190,11 @@ crate fn assemble_builtin_sized_impls<'tcx>(
188
190
push_builtin_impl ( adt, & sized_constraint) ;
189
191
}
190
192
191
- // Artificially trigger an ambiguity.
192
- ty:: Infer ( ..) => {
193
- // Everybody can find at least two types to unify against:
194
- // general ty vars, int vars and float vars.
193
+ // Artificially trigger an ambiguity by adding two possible types to
194
+ // unify against.
195
+ ty:: Infer ( ty:: TyVar ( _) ) => {
195
196
push_builtin_impl ( tcx. types . i32 , & [ ] ) ;
196
- push_builtin_impl ( tcx. types . u32 , & [ ] ) ;
197
197
push_builtin_impl ( tcx. types . f32 , & [ ] ) ;
198
- push_builtin_impl ( tcx. types . f64 , & [ ] ) ;
199
198
}
200
199
201
200
ty:: Projection ( _projection_ty) => {
@@ -216,7 +215,10 @@ crate fn assemble_builtin_sized_impls<'tcx>(
216
215
ty:: Opaque ( ..) => ( ) ,
217
216
218
217
ty:: Bound ( ..) |
219
- ty:: GeneratorWitness ( ..) => bug ! ( "unexpected type {:?}" , ty) ,
218
+ ty:: GeneratorWitness ( ..) |
219
+ ty:: Infer ( ty:: FreshTy ( _) ) |
220
+ ty:: Infer ( ty:: FreshIntTy ( _) ) |
221
+ ty:: Infer ( ty:: FreshFloatTy ( _) ) => bug ! ( "unexpected type {:?}" , ty) ,
220
222
}
221
223
}
222
224
@@ -243,7 +245,9 @@ crate fn assemble_builtin_copy_clone_impls<'tcx>(
243
245
ty:: Never |
244
246
ty:: Ref ( _, _, hir:: MutImmutable ) => ( ) ,
245
247
246
- // Non parametric primitive type.
248
+ // Non parametric primitive types.
249
+ ty:: Infer ( ty:: IntVar ( _) ) |
250
+ ty:: Infer ( ty:: FloatVar ( _) ) |
247
251
ty:: Error => push_builtin_impl ( ty, & [ ] ) ,
248
252
249
253
// These implement `Copy`/`Clone` if their element types do.
@@ -283,13 +287,11 @@ crate fn assemble_builtin_copy_clone_impls<'tcx>(
283
287
// These depend on whatever user-defined impls might exist.
284
288
ty:: Adt ( _, _) => ( ) ,
285
289
286
- // int vars and float vars are always `Copy`.
287
- // Other vars will trigger an ambiguity .
288
- ty:: Infer ( .. ) => {
290
+ // Artificially trigger an ambiguity by adding two possible types to
291
+ // unify against .
292
+ ty:: Infer ( ty :: TyVar ( _ ) ) => {
289
293
push_builtin_impl ( tcx. types . i32 , & [ ] ) ;
290
- push_builtin_impl ( tcx. types . u32 , & [ ] ) ;
291
294
push_builtin_impl ( tcx. types . f32 , & [ ] ) ;
292
- push_builtin_impl ( tcx. types . f64 , & [ ] ) ;
293
295
}
294
296
295
297
ty:: Projection ( _projection_ty) => {
@@ -312,6 +314,9 @@ crate fn assemble_builtin_copy_clone_impls<'tcx>(
312
314
ty:: Ref ( _, _, hir:: MutMutable ) => ( ) ,
313
315
314
316
ty:: Bound ( ..) |
315
- ty:: GeneratorWitness ( ..) => bug ! ( "unexpected type {:?}" , ty) ,
317
+ ty:: GeneratorWitness ( ..) |
318
+ ty:: Infer ( ty:: FreshTy ( _) ) |
319
+ ty:: Infer ( ty:: FreshIntTy ( _) ) |
320
+ ty:: Infer ( ty:: FreshFloatTy ( _) ) => bug ! ( "unexpected type {:?}" , ty) ,
316
321
}
317
322
}
0 commit comments