@@ -407,7 +407,7 @@ pub fn can_mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
407
407
origin : TypeOrigin :: Misc ( codemap:: DUMMY_SP ) ,
408
408
values : Types ( expected_found ( true , a, b) )
409
409
} ;
410
- cx. sub ( true , trace) . relate ( & a, & b) . map ( |_| ( ) )
410
+ cx. sub ( true , trace, & a, & b) . map ( |_| ( ) )
411
411
} )
412
412
}
413
413
@@ -668,32 +668,32 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
668
668
cause : None }
669
669
}
670
670
671
- // public so that it can be used from the rustc_driver unit tests
672
- pub fn equate ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > )
673
- -> equate :: Equate < ' a , ' tcx >
671
+ pub fn equate < T > ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > , a : & T , b : & T )
672
+ -> RelateResult < ' tcx , T >
673
+ where T : Relate < ' a , ' tcx >
674
674
{
675
- self . combine_fields ( a_is_expected, trace) . equate ( )
675
+ self . combine_fields ( a_is_expected, trace) . equate ( ) . relate ( a , b )
676
676
}
677
677
678
- // public so that it can be used from the rustc_driver unit tests
679
- pub fn sub ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > )
680
- -> sub :: Sub < ' a , ' tcx >
678
+ pub fn sub < T > ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > , a : & T , b : & T )
679
+ -> RelateResult < ' tcx , T >
680
+ where T : Relate < ' a , ' tcx >
681
681
{
682
- self . combine_fields ( a_is_expected, trace) . sub ( )
682
+ self . combine_fields ( a_is_expected, trace) . sub ( ) . relate ( a , b )
683
683
}
684
684
685
- // public so that it can be used from the rustc_driver unit tests
686
- pub fn lub ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > )
687
- -> lub :: Lub < ' a , ' tcx >
685
+ pub fn lub < T > ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > , a : & T , b : & T )
686
+ -> RelateResult < ' tcx , T >
687
+ where T : Relate < ' a , ' tcx >
688
688
{
689
- self . combine_fields ( a_is_expected, trace) . lub ( )
689
+ self . combine_fields ( a_is_expected, trace) . lub ( ) . relate ( a , b )
690
690
}
691
691
692
- // public so that it can be used from the rustc_driver unit tests
693
- pub fn glb ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > )
694
- -> glb :: Glb < ' a , ' tcx >
692
+ pub fn glb < T > ( & ' a self , a_is_expected : bool , trace : TypeTrace < ' tcx > , a : & T , b : & T )
693
+ -> RelateResult < ' tcx , T >
694
+ where T : Relate < ' a , ' tcx >
695
695
{
696
- self . combine_fields ( a_is_expected, trace) . glb ( )
696
+ self . combine_fields ( a_is_expected, trace) . glb ( ) . relate ( a , b )
697
697
}
698
698
699
699
fn start_snapshot ( & self ) -> CombinedSnapshot {
@@ -834,7 +834,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
834
834
debug ! ( "sub_types({:?} <: {:?})" , a, b) ;
835
835
self . commit_if_ok ( |_| {
836
836
let trace = TypeTrace :: types ( origin, a_is_expected, a, b) ;
837
- self . sub ( a_is_expected, trace) . relate ( & a, & b) . map ( |_| ( ) )
837
+ self . sub ( a_is_expected, trace, & a, & b) . map ( |_| ( ) )
838
838
} )
839
839
}
840
840
@@ -847,7 +847,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
847
847
{
848
848
self . commit_if_ok ( |_| {
849
849
let trace = TypeTrace :: types ( origin, a_is_expected, a, b) ;
850
- self . equate ( a_is_expected, trace) . relate ( & a, & b) . map ( |_| ( ) )
850
+ self . equate ( a_is_expected, trace, & a, & b) . map ( |_| ( ) )
851
851
} )
852
852
}
853
853
@@ -866,7 +866,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
866
866
origin : origin,
867
867
values : TraitRefs ( expected_found ( a_is_expected, a. clone ( ) , b. clone ( ) ) )
868
868
} ;
869
- self . equate ( a_is_expected, trace) . relate ( & a, & b) . map ( |_| ( ) )
869
+ self . equate ( a_is_expected, trace, & a, & b) . map ( |_| ( ) )
870
870
} )
871
871
}
872
872
@@ -885,7 +885,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
885
885
origin : origin,
886
886
values : PolyTraitRefs ( expected_found ( a_is_expected, a. clone ( ) , b. clone ( ) ) )
887
887
} ;
888
- self . sub ( a_is_expected, trace) . relate ( & a, & b) . map ( |_| ( ) )
888
+ self . sub ( a_is_expected, trace, & a, & b) . map ( |_| ( ) )
889
889
} )
890
890
}
891
891
@@ -1434,7 +1434,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1434
1434
origin : TypeOrigin :: Misc ( codemap:: DUMMY_SP ) ,
1435
1435
values : Types ( expected_found ( true , e, e) )
1436
1436
} ;
1437
- self . equate ( true , trace) . relate ( a, b)
1437
+ self . equate ( true , trace, a, b)
1438
1438
} ) . map ( |_| ( ) )
1439
1439
}
1440
1440
0 commit comments