@@ -57,7 +57,6 @@ impl<'tcx> InferCtxt<'tcx> {
5757 where
5858 R : ObligationEmittingRelation < ' tcx > ,
5959 {
60- let a_is_expected = relation. a_is_expected ( ) ;
6160 debug_assert ! ( !a. has_escaping_bound_vars( ) ) ;
6261 debug_assert ! ( !b. has_escaping_bound_vars( ) ) ;
6362
@@ -68,20 +67,20 @@ impl<'tcx> InferCtxt<'tcx> {
6867 . borrow_mut ( )
6968 . int_unification_table ( )
7069 . unify_var_var ( a_id, b_id)
71- . map_err ( |e| int_unification_error ( a_is_expected , e) ) ?;
70+ . map_err ( |e| int_unification_error ( true , e) ) ?;
7271 Ok ( a)
7372 }
7473 ( & ty:: Infer ( ty:: IntVar ( v_id) ) , & ty:: Int ( v) ) => {
75- self . unify_integral_variable ( a_is_expected , v_id, IntType ( v) )
74+ self . unify_integral_variable ( true , v_id, IntType ( v) )
7675 }
7776 ( & ty:: Int ( v) , & ty:: Infer ( ty:: IntVar ( v_id) ) ) => {
78- self . unify_integral_variable ( !a_is_expected , v_id, IntType ( v) )
77+ self . unify_integral_variable ( !true , v_id, IntType ( v) )
7978 }
8079 ( & ty:: Infer ( ty:: IntVar ( v_id) ) , & ty:: Uint ( v) ) => {
81- self . unify_integral_variable ( a_is_expected , v_id, UintType ( v) )
80+ self . unify_integral_variable ( true , v_id, UintType ( v) )
8281 }
8382 ( & ty:: Uint ( v) , & ty:: Infer ( ty:: IntVar ( v_id) ) ) => {
84- self . unify_integral_variable ( !a_is_expected , v_id, UintType ( v) )
83+ self . unify_integral_variable ( !true , v_id, UintType ( v) )
8584 }
8685
8786 // Relate floating-point variables to other types
@@ -90,14 +89,14 @@ impl<'tcx> InferCtxt<'tcx> {
9089 . borrow_mut ( )
9190 . float_unification_table ( )
9291 . unify_var_var ( a_id, b_id)
93- . map_err ( |e| float_unification_error ( a_is_expected , e) ) ?;
92+ . map_err ( |e| float_unification_error ( true , e) ) ?;
9493 Ok ( a)
9594 }
9695 ( & ty:: Infer ( ty:: FloatVar ( v_id) ) , & ty:: Float ( v) ) => {
97- self . unify_float_variable ( a_is_expected , v_id, v)
96+ self . unify_float_variable ( true , v_id, v)
9897 }
9998 ( & ty:: Float ( v) , & ty:: Infer ( ty:: FloatVar ( v_id) ) ) => {
100- self . unify_float_variable ( !a_is_expected , v_id, v)
99+ self . unify_float_variable ( !true , v_id, v)
101100 }
102101
103102 // We don't expect `TyVar` or `Fresh*` vars at this point with lazy norm.
@@ -130,7 +129,7 @@ impl<'tcx> InferCtxt<'tcx> {
130129
131130 // All other cases of inference are errors
132131 ( & ty:: Infer ( _) , _) | ( _, & ty:: Infer ( _) ) => {
133- Err ( TypeError :: Sorts ( ty:: relate:: expected_found ( relation , a, b) ) )
132+ Err ( TypeError :: Sorts ( ty:: relate:: expected_found ( a, b) ) )
134133 }
135134
136135 // During coherence, opaque types should be treated as *possibly*
@@ -228,12 +227,12 @@ impl<'tcx> InferCtxt<'tcx> {
228227 }
229228
230229 ( ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) , _) => {
231- self . instantiate_const_var ( relation, relation . a_is_expected ( ) , vid, b) ?;
230+ self . instantiate_const_var ( relation, true , vid, b) ?;
232231 Ok ( b)
233232 }
234233
235234 ( _, ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) ) => {
236- self . instantiate_const_var ( relation, !relation . a_is_expected ( ) , vid, a) ?;
235+ self . instantiate_const_var ( relation, false , vid, a) ?;
237236 Ok ( a)
238237 }
239238
@@ -250,8 +249,6 @@ impl<'tcx> InferCtxt<'tcx> {
250249 {
251250 match relation. structurally_relate_aliases ( ) {
252251 StructurallyRelateAliases :: No => {
253- let ( a, b) = if relation. a_is_expected ( ) { ( a, b) } else { ( b, a) } ;
254-
255252 relation. register_predicates ( [ if self . next_trait_solver ( ) {
256253 ty:: PredicateKind :: AliasRelate (
257254 a. into ( ) ,
0 commit comments