@@ -325,8 +325,8 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
325
325
) -> RelateResult < ' tcx , Ty < ' tcx > > {
326
326
let tcx = relation. tcx ( ) ;
327
327
debug ! ( "super_relate_tys: a={:?} b={:?}" , a, b) ;
328
- match ( & a. kind ( ) , & b. kind ( ) ) {
329
- ( & ty:: Infer ( _) , _) | ( _, & ty:: Infer ( _) ) => {
328
+ match ( a. kind ( ) , b. kind ( ) ) {
329
+ ( ty:: Infer ( _) , _) | ( _, ty:: Infer ( _) ) => {
330
330
// The caller should handle these cases!
331
331
bug ! ( "var types encountered in super_relate_tys" )
332
332
}
@@ -335,39 +335,39 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
335
335
bug ! ( "bound types encountered in super_relate_tys" )
336
336
}
337
337
338
- ( & ty:: Error ( _) , _) | ( _, & ty:: Error ( _) ) => Ok ( tcx. ty_error ( ) ) ,
338
+ ( ty:: Error ( _) , _) | ( _, ty:: Error ( _) ) => Ok ( tcx. ty_error ( ) ) ,
339
339
340
- ( & ty:: Never , _)
341
- | ( & ty:: Char , _)
342
- | ( & ty:: Bool , _)
343
- | ( & ty:: Int ( _) , _)
344
- | ( & ty:: Uint ( _) , _)
345
- | ( & ty:: Float ( _) , _)
346
- | ( & ty:: Str , _)
340
+ ( ty:: Never , _)
341
+ | ( ty:: Char , _)
342
+ | ( ty:: Bool , _)
343
+ | ( ty:: Int ( _) , _)
344
+ | ( ty:: Uint ( _) , _)
345
+ | ( ty:: Float ( _) , _)
346
+ | ( ty:: Str , _)
347
347
if a == b =>
348
348
{
349
349
Ok ( a)
350
350
}
351
351
352
- ( & ty:: Param ( ref a_p) , & ty:: Param ( ref b_p) ) if a_p. index == b_p. index => Ok ( a) ,
352
+ ( ty:: Param ( a_p) , ty:: Param ( b_p) ) if a_p. index == b_p. index => Ok ( a) ,
353
353
354
354
( ty:: Placeholder ( p1) , ty:: Placeholder ( p2) ) if p1 == p2 => Ok ( a) ,
355
355
356
- ( & ty:: Adt ( a_def, a_substs) , & ty:: Adt ( b_def, b_substs) ) if a_def == b_def => {
356
+ ( ty:: Adt ( a_def, a_substs) , ty:: Adt ( b_def, b_substs) ) if a_def == b_def => {
357
357
let substs = relation. relate_item_substs ( a_def. did , a_substs, b_substs) ?;
358
358
Ok ( tcx. mk_adt ( a_def, substs) )
359
359
}
360
360
361
- ( & ty:: Foreign ( a_id) , & ty:: Foreign ( b_id) ) if a_id == b_id => Ok ( tcx. mk_foreign ( a_id) ) ,
361
+ ( ty:: Foreign ( a_id) , ty:: Foreign ( b_id) ) if a_id == b_id => Ok ( tcx. mk_foreign ( a_id) ) ,
362
362
363
- ( & ty:: Dynamic ( a_obj, a_region) , & ty:: Dynamic ( b_obj, b_region) ) => {
363
+ ( ty:: Dynamic ( a_obj, a_region) , ty:: Dynamic ( b_obj, b_region) ) => {
364
364
let region_bound = relation. with_cause ( Cause :: ExistentialRegionBound , |relation| {
365
365
relation. relate_with_variance ( ty:: Contravariant , a_region, b_region)
366
366
} ) ?;
367
367
Ok ( tcx. mk_dynamic ( relation. relate ( a_obj, b_obj) ?, region_bound) )
368
368
}
369
369
370
- ( & ty:: Generator ( a_id, a_substs, movability) , & ty:: Generator ( b_id, b_substs, _) )
370
+ ( ty:: Generator ( a_id, a_substs, movability) , ty:: Generator ( b_id, b_substs, _) )
371
371
if a_id == b_id =>
372
372
{
373
373
// All Generator types with the same id represent
@@ -377,7 +377,7 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
377
377
Ok ( tcx. mk_generator ( a_id, substs, movability) )
378
378
}
379
379
380
- ( & ty:: GeneratorWitness ( a_types) , & ty:: GeneratorWitness ( b_types) ) => {
380
+ ( ty:: GeneratorWitness ( a_types) , ty:: GeneratorWitness ( b_types) ) => {
381
381
// Wrap our types with a temporary GeneratorWitness struct
382
382
// inside the binder so we can related them
383
383
let a_types = a_types. map_bound ( GeneratorWitness ) ;
@@ -387,28 +387,28 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
387
387
Ok ( tcx. mk_generator_witness ( types) )
388
388
}
389
389
390
- ( & ty:: Closure ( a_id, a_substs) , & ty:: Closure ( b_id, b_substs) ) if a_id == b_id => {
390
+ ( ty:: Closure ( a_id, a_substs) , ty:: Closure ( b_id, b_substs) ) if a_id == b_id => {
391
391
// All Closure types with the same id represent
392
392
// the (anonymous) type of the same closure expression. So
393
393
// all of their regions should be equated.
394
394
let substs = relation. relate ( a_substs, b_substs) ?;
395
395
Ok ( tcx. mk_closure ( a_id, & substs) )
396
396
}
397
397
398
- ( & ty:: RawPtr ( a_mt) , & ty:: RawPtr ( b_mt) ) => {
398
+ ( ty:: RawPtr ( a_mt) , ty:: RawPtr ( b_mt) ) => {
399
399
let mt = relation. relate ( a_mt, b_mt) ?;
400
400
Ok ( tcx. mk_ptr ( mt) )
401
401
}
402
402
403
- ( & ty:: Ref ( a_r, a_ty, a_mutbl) , & ty:: Ref ( b_r, b_ty, b_mutbl) ) => {
403
+ ( ty:: Ref ( a_r, a_ty, a_mutbl) , ty:: Ref ( b_r, b_ty, b_mutbl) ) => {
404
404
let r = relation. relate_with_variance ( ty:: Contravariant , a_r, b_r) ?;
405
405
let a_mt = ty:: TypeAndMut { ty : a_ty, mutbl : a_mutbl } ;
406
406
let b_mt = ty:: TypeAndMut { ty : b_ty, mutbl : b_mutbl } ;
407
407
let mt = relation. relate ( a_mt, b_mt) ?;
408
408
Ok ( tcx. mk_ref ( r, mt) )
409
409
}
410
410
411
- ( & ty:: Array ( a_t, sz_a) , & ty:: Array ( b_t, sz_b) ) => {
411
+ ( ty:: Array ( a_t, sz_a) , ty:: Array ( b_t, sz_b) ) => {
412
412
let t = relation. relate ( a_t, b_t) ?;
413
413
match relation. relate ( sz_a, sz_b) {
414
414
Ok ( sz) => Ok ( tcx. mk_ty ( ty:: Array ( t, sz) ) ) ,
@@ -430,12 +430,12 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
430
430
}
431
431
}
432
432
433
- ( & ty:: Slice ( a_t) , & ty:: Slice ( b_t) ) => {
433
+ ( ty:: Slice ( a_t) , ty:: Slice ( b_t) ) => {
434
434
let t = relation. relate ( a_t, b_t) ?;
435
435
Ok ( tcx. mk_slice ( t) )
436
436
}
437
437
438
- ( & ty:: Tuple ( as_) , & ty:: Tuple ( bs) ) => {
438
+ ( ty:: Tuple ( as_) , ty:: Tuple ( bs) ) => {
439
439
if as_. len ( ) == bs. len ( ) {
440
440
Ok ( tcx. mk_tup (
441
441
as_. iter ( ) . zip ( bs) . map ( |( a, b) | relation. relate ( a. expect_ty ( ) , b. expect_ty ( ) ) ) ,
@@ -447,25 +447,23 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
447
447
}
448
448
}
449
449
450
- ( & ty:: FnDef ( a_def_id, a_substs) , & ty:: FnDef ( b_def_id, b_substs) )
451
- if a_def_id == b_def_id =>
452
- {
450
+ ( ty:: FnDef ( a_def_id, a_substs) , ty:: FnDef ( b_def_id, b_substs) ) if a_def_id == b_def_id => {
453
451
let substs = relation. relate_item_substs ( a_def_id, a_substs, b_substs) ?;
454
452
Ok ( tcx. mk_fn_def ( a_def_id, substs) )
455
453
}
456
454
457
- ( & ty:: FnPtr ( a_fty) , & ty:: FnPtr ( b_fty) ) => {
455
+ ( ty:: FnPtr ( a_fty) , ty:: FnPtr ( b_fty) ) => {
458
456
let fty = relation. relate ( a_fty, b_fty) ?;
459
457
Ok ( tcx. mk_fn_ptr ( fty) )
460
458
}
461
459
462
460
// these two are already handled downstream in case of lazy normalization
463
- ( & ty:: Projection ( a_data) , & ty:: Projection ( b_data) ) => {
461
+ ( ty:: Projection ( a_data) , ty:: Projection ( b_data) ) => {
464
462
let projection_ty = relation. relate ( a_data, b_data) ?;
465
463
Ok ( tcx. mk_projection ( projection_ty. item_def_id , projection_ty. substs ) )
466
464
}
467
465
468
- ( & ty:: Opaque ( a_def_id, a_substs) , & ty:: Opaque ( b_def_id, b_substs) )
466
+ ( ty:: Opaque ( a_def_id, a_substs) , ty:: Opaque ( b_def_id, b_substs) )
469
467
if a_def_id == b_def_id =>
470
468
{
471
469
let substs = relate_substs ( relation, None , a_substs, b_substs) ?;
0 commit comments