@@ -407,7 +407,7 @@ pub fn can_mk_subty<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
407407 origin : TypeOrigin :: Misc ( codemap:: DUMMY_SP ) ,
408408 values : Types ( expected_found ( true , a, b) )
409409 } ;
410- cx. sub ( true , trace) . relate ( & a, & b) . map ( |_| ( ) )
410+ cx. sub ( true , trace, & a, & b) . map ( |_| ( ) )
411411 } )
412412}
413413
@@ -668,32 +668,32 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
668668 cause : None }
669669 }
670670
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 >
674674 {
675- self . combine_fields ( a_is_expected, trace) . equate ( )
675+ self . combine_fields ( a_is_expected, trace) . equate ( ) . relate ( a , b )
676676 }
677677
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 >
681681 {
682- self . combine_fields ( a_is_expected, trace) . sub ( )
682+ self . combine_fields ( a_is_expected, trace) . sub ( ) . relate ( a , b )
683683 }
684684
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 >
688688 {
689- self . combine_fields ( a_is_expected, trace) . lub ( )
689+ self . combine_fields ( a_is_expected, trace) . lub ( ) . relate ( a , b )
690690 }
691691
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 >
695695 {
696- self . combine_fields ( a_is_expected, trace) . glb ( )
696+ self . combine_fields ( a_is_expected, trace) . glb ( ) . relate ( a , b )
697697 }
698698
699699 fn start_snapshot ( & self ) -> CombinedSnapshot {
@@ -834,7 +834,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
834834 debug ! ( "sub_types({:?} <: {:?})" , a, b) ;
835835 self . commit_if_ok ( |_| {
836836 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 ( |_| ( ) )
838838 } )
839839 }
840840
@@ -847,7 +847,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
847847 {
848848 self . commit_if_ok ( |_| {
849849 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 ( |_| ( ) )
851851 } )
852852 }
853853
@@ -866,7 +866,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
866866 origin : origin,
867867 values : TraitRefs ( expected_found ( a_is_expected, a. clone ( ) , b. clone ( ) ) )
868868 } ;
869- self . equate ( a_is_expected, trace) . relate ( & a, & b) . map ( |_| ( ) )
869+ self . equate ( a_is_expected, trace, & a, & b) . map ( |_| ( ) )
870870 } )
871871 }
872872
@@ -885,7 +885,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
885885 origin : origin,
886886 values : PolyTraitRefs ( expected_found ( a_is_expected, a. clone ( ) , b. clone ( ) ) )
887887 } ;
888- self . sub ( a_is_expected, trace) . relate ( & a, & b) . map ( |_| ( ) )
888+ self . sub ( a_is_expected, trace, & a, & b) . map ( |_| ( ) )
889889 } )
890890 }
891891
@@ -1434,7 +1434,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14341434 origin : TypeOrigin :: Misc ( codemap:: DUMMY_SP ) ,
14351435 values : Types ( expected_found ( true , e, e) )
14361436 } ;
1437- self . equate ( true , trace) . relate ( a, b)
1437+ self . equate ( true , trace, a, b)
14381438 } ) . map ( |_| ( ) )
14391439 }
14401440
0 commit comments