@@ -434,12 +434,12 @@ pub fn super_fn_sigs<C:Combine>(
434
434
pub fn super_tys < C : Combine > (
435
435
this : & C , a : ty:: t , b : ty:: t ) -> cres < ty:: t > {
436
436
let tcx = this. infcx ( ) . tcx ;
437
- return match ( /*bad*/ copy ty:: get ( a) . sty , /*bad*/ copy ty:: get ( b) . sty ) {
437
+ return match ( & ty:: get ( a) . sty , & ty:: get ( b) . sty ) {
438
438
// The "subtype" ought to be handling cases involving bot or var:
439
- ( ty:: ty_bot, _) |
440
- ( _, ty:: ty_bot) |
441
- ( ty:: ty_infer( TyVar ( _) ) , _) |
442
- ( _, ty:: ty_infer( TyVar ( _) ) ) => {
439
+ ( & ty:: ty_bot, _) |
440
+ ( _, & ty:: ty_bot) |
441
+ ( & ty:: ty_infer( TyVar ( _) ) , _) |
442
+ ( _, & ty:: ty_infer( TyVar ( _) ) ) => {
443
443
tcx. sess . bug (
444
444
fmt ! ( "%s: bot and var types should have been handled (%s,%s)" ,
445
445
this. tag( ) ,
@@ -448,68 +448,68 @@ pub fn super_tys<C:Combine>(
448
448
}
449
449
450
450
// Relate integral variables to other types
451
- ( ty:: ty_infer( IntVar ( a_id) ) , ty:: ty_infer( IntVar ( b_id) ) ) => {
451
+ ( & ty:: ty_infer( IntVar ( a_id) ) , & ty:: ty_infer( IntVar ( b_id) ) ) => {
452
452
if_ok ! ( this. infcx( ) . simple_vars( this. a_is_expected( ) ,
453
453
a_id, b_id) ) ;
454
454
Ok ( a)
455
455
}
456
- ( ty:: ty_infer( IntVar ( v_id) ) , ty:: ty_int( v) ) => {
456
+ ( & ty:: ty_infer( IntVar ( v_id) ) , & ty:: ty_int( v) ) => {
457
457
unify_integral_variable ( this, this. a_is_expected ( ) ,
458
458
v_id, IntType ( v) )
459
459
}
460
- ( ty:: ty_int( v) , ty:: ty_infer( IntVar ( v_id) ) ) => {
460
+ ( & ty:: ty_int( v) , & ty:: ty_infer( IntVar ( v_id) ) ) => {
461
461
unify_integral_variable ( this, !this. a_is_expected ( ) ,
462
462
v_id, IntType ( v) )
463
463
}
464
- ( ty:: ty_infer( IntVar ( v_id) ) , ty:: ty_uint( v) ) => {
464
+ ( & ty:: ty_infer( IntVar ( v_id) ) , & ty:: ty_uint( v) ) => {
465
465
unify_integral_variable ( this, this. a_is_expected ( ) ,
466
466
v_id, UintType ( v) )
467
467
}
468
- ( ty:: ty_uint( v) , ty:: ty_infer( IntVar ( v_id) ) ) => {
468
+ ( & ty:: ty_uint( v) , & ty:: ty_infer( IntVar ( v_id) ) ) => {
469
469
unify_integral_variable ( this, !this. a_is_expected ( ) ,
470
470
v_id, UintType ( v) )
471
471
}
472
472
473
473
// Relate floating-point variables to other types
474
- ( ty:: ty_infer( FloatVar ( a_id) ) , ty:: ty_infer( FloatVar ( b_id) ) ) => {
474
+ ( & ty:: ty_infer( FloatVar ( a_id) ) , & ty:: ty_infer( FloatVar ( b_id) ) ) => {
475
475
if_ok ! ( this. infcx( ) . simple_vars( this. a_is_expected( ) ,
476
476
a_id, b_id) ) ;
477
477
Ok ( a)
478
478
}
479
- ( ty:: ty_infer( FloatVar ( v_id) ) , ty:: ty_float( v) ) => {
479
+ ( & ty:: ty_infer( FloatVar ( v_id) ) , & ty:: ty_float( v) ) => {
480
480
unify_float_variable ( this, this. a_is_expected ( ) , v_id, v)
481
481
}
482
- ( ty:: ty_float( v) , ty:: ty_infer( FloatVar ( v_id) ) ) => {
482
+ ( & ty:: ty_float( v) , & ty:: ty_infer( FloatVar ( v_id) ) ) => {
483
483
unify_float_variable ( this, !this. a_is_expected ( ) , v_id, v)
484
484
}
485
485
486
- ( ty:: ty_nil, _) |
487
- ( ty:: ty_bool, _) |
488
- ( ty:: ty_int( _) , _) |
489
- ( ty:: ty_uint( _) , _) |
490
- ( ty:: ty_float( _) , _) => {
486
+ ( & ty:: ty_nil, _) |
487
+ ( & ty:: ty_bool, _) |
488
+ ( & ty:: ty_int( _) , _) |
489
+ ( & ty:: ty_uint( _) , _) |
490
+ ( & ty:: ty_float( _) , _) => {
491
491
if ty:: get ( a) . sty == ty:: get ( b) . sty {
492
492
Ok ( a)
493
493
} else {
494
494
Err ( ty:: terr_sorts ( expected_found ( this, a, b) ) )
495
495
}
496
496
}
497
497
498
- ( ty:: ty_param( ref a_p) , ty:: ty_param( ref b_p) ) if a_p. idx == b_p. idx => {
498
+ ( & ty:: ty_param( ref a_p) , & ty:: ty_param( ref b_p) ) if a_p. idx == b_p. idx => {
499
499
Ok ( a)
500
500
}
501
501
502
- ( ty:: ty_enum( a_id, ref a_substs) ,
503
- ty:: ty_enum( b_id, ref b_substs) )
502
+ ( & ty:: ty_enum( a_id, ref a_substs) ,
503
+ & ty:: ty_enum( b_id, ref b_substs) )
504
504
if a_id == b_id => {
505
505
let type_def = ty:: lookup_item_type ( tcx, a_id) ;
506
506
do this. substs ( & type_def. generics , a_substs, b_substs) . chain |substs| {
507
507
Ok ( ty:: mk_enum ( tcx, a_id, substs) )
508
508
}
509
509
}
510
510
511
- ( ty:: ty_trait( a_id, ref a_substs, a_store, a_mutbl) ,
512
- ty:: ty_trait( b_id, ref b_substs, b_store, b_mutbl) )
511
+ ( & ty:: ty_trait( a_id, ref a_substs, a_store, a_mutbl) ,
512
+ & ty:: ty_trait( b_id, ref b_substs, b_store, b_mutbl) )
513
513
if a_id == b_id && a_mutbl == b_mutbl => {
514
514
let trait_def = ty:: lookup_trait_def ( tcx, a_id) ;
515
515
do this. substs ( & trait_def. generics , a_substs, b_substs) . chain |substs| {
@@ -519,53 +519,53 @@ pub fn super_tys<C:Combine>(
519
519
}
520
520
}
521
521
522
- ( ty:: ty_struct( a_id, ref a_substs) , ty:: ty_struct( b_id, ref b_substs) )
522
+ ( & ty:: ty_struct( a_id, ref a_substs) , & ty:: ty_struct( b_id, ref b_substs) )
523
523
if a_id == b_id => {
524
524
let type_def = ty:: lookup_item_type ( tcx, a_id) ;
525
525
do this. substs ( & type_def. generics , a_substs, b_substs) . chain |substs| {
526
526
Ok ( ty:: mk_struct ( tcx, a_id, substs) )
527
527
}
528
528
}
529
529
530
- ( ty:: ty_box( ref a_mt) , ty:: ty_box( ref b_mt) ) => {
530
+ ( & ty:: ty_box( ref a_mt) , & ty:: ty_box( ref b_mt) ) => {
531
531
do this. mts ( a_mt, b_mt) . chain |mt| {
532
532
Ok ( ty:: mk_box ( tcx, mt) )
533
533
}
534
534
}
535
535
536
- ( ty:: ty_uniq( ref a_mt) , ty:: ty_uniq( ref b_mt) ) => {
536
+ ( & ty:: ty_uniq( ref a_mt) , & ty:: ty_uniq( ref b_mt) ) => {
537
537
do this. mts ( a_mt, b_mt) . chain |mt| {
538
538
Ok ( ty:: mk_uniq ( tcx, mt) )
539
539
}
540
540
}
541
541
542
- ( ty:: ty_ptr( ref a_mt) , ty:: ty_ptr( ref b_mt) ) => {
542
+ ( & ty:: ty_ptr( ref a_mt) , & ty:: ty_ptr( ref b_mt) ) => {
543
543
do this. mts ( a_mt, b_mt) . chain |mt| {
544
544
Ok ( ty:: mk_ptr ( tcx, mt) )
545
545
}
546
546
}
547
547
548
- ( ty:: ty_rptr( a_r, ref a_mt) , ty:: ty_rptr( b_r, ref b_mt) ) => {
548
+ ( & ty:: ty_rptr( a_r, ref a_mt) , & ty:: ty_rptr( b_r, ref b_mt) ) => {
549
549
let r = if_ok ! ( this. contraregions( a_r, b_r) ) ;
550
550
let mt = if_ok ! ( this. mts( a_mt, b_mt) ) ;
551
551
Ok ( ty:: mk_rptr ( tcx, r, mt) )
552
552
}
553
553
554
- ( ty:: ty_evec( ref a_mt, vs_a) , ty:: ty_evec( ref b_mt, vs_b) ) => {
554
+ ( & ty:: ty_evec( ref a_mt, vs_a) , & ty:: ty_evec( ref b_mt, vs_b) ) => {
555
555
do this. mts ( a_mt, b_mt) . chain |mt| {
556
556
do this. vstores ( ty:: terr_vec, vs_a, vs_b) . chain |vs| {
557
557
Ok ( ty:: mk_evec ( tcx, mt, vs) )
558
558
}
559
559
}
560
560
}
561
561
562
- ( ty:: ty_estr( vs_a) , ty:: ty_estr( vs_b) ) => {
562
+ ( & ty:: ty_estr( vs_a) , & ty:: ty_estr( vs_b) ) => {
563
563
do this. vstores ( ty:: terr_str, vs_a, vs_b) . chain |vs| {
564
564
Ok ( ty:: mk_estr ( tcx, vs) )
565
565
}
566
566
}
567
567
568
- ( ty:: ty_tup( ref as_) , ty:: ty_tup( ref bs) ) => {
568
+ ( & ty:: ty_tup( ref as_) , & ty:: ty_tup( ref bs) ) => {
569
569
if as_. len ( ) == bs. len ( ) {
570
570
map_vec2 ( * as_, * bs, |a, b| this. tys ( * a, * b) )
571
571
. chain ( |ts| Ok ( ty:: mk_tup ( tcx, ts) ) )
@@ -575,13 +575,13 @@ pub fn super_tys<C:Combine>(
575
575
}
576
576
}
577
577
578
- ( ty:: ty_bare_fn( ref a_fty) , ty:: ty_bare_fn( ref b_fty) ) => {
578
+ ( & ty:: ty_bare_fn( ref a_fty) , & ty:: ty_bare_fn( ref b_fty) ) => {
579
579
do this. bare_fn_tys ( a_fty, b_fty) . chain |fty| {
580
580
Ok ( ty:: mk_bare_fn ( tcx, fty) )
581
581
}
582
582
}
583
583
584
- ( ty:: ty_closure( ref a_fty) , ty:: ty_closure( ref b_fty) ) => {
584
+ ( & ty:: ty_closure( ref a_fty) , & ty:: ty_closure( ref b_fty) ) => {
585
585
do this. closure_tys ( a_fty, b_fty) . chain |fty| {
586
586
Ok ( ty:: mk_closure ( tcx, fty) )
587
587
}
0 commit comments