@@ -57,7 +57,6 @@ impl<'tcx> InferCtxt<'tcx> {
57
57
where
58
58
R : ObligationEmittingRelation < ' tcx > ,
59
59
{
60
- let a_is_expected = relation. a_is_expected ( ) ;
61
60
debug_assert ! ( !a. has_escaping_bound_vars( ) ) ;
62
61
debug_assert ! ( !b. has_escaping_bound_vars( ) ) ;
63
62
@@ -68,20 +67,20 @@ impl<'tcx> InferCtxt<'tcx> {
68
67
. borrow_mut ( )
69
68
. int_unification_table ( )
70
69
. 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) ) ?;
72
71
Ok ( a)
73
72
}
74
73
( & 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) )
76
75
}
77
76
( & 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) )
79
78
}
80
79
( & 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) )
82
81
}
83
82
( & 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) )
85
84
}
86
85
87
86
// Relate floating-point variables to other types
@@ -90,14 +89,14 @@ impl<'tcx> InferCtxt<'tcx> {
90
89
. borrow_mut ( )
91
90
. float_unification_table ( )
92
91
. 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) ) ?;
94
93
Ok ( a)
95
94
}
96
95
( & 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)
98
97
}
99
98
( & 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)
101
100
}
102
101
103
102
// We don't expect `TyVar` or `Fresh*` vars at this point with lazy norm.
@@ -130,7 +129,7 @@ impl<'tcx> InferCtxt<'tcx> {
130
129
131
130
// All other cases of inference are errors
132
131
( & 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) ) )
134
133
}
135
134
136
135
// During coherence, opaque types should be treated as *possibly*
@@ -228,12 +227,12 @@ impl<'tcx> InferCtxt<'tcx> {
228
227
}
229
228
230
229
( 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) ?;
232
231
Ok ( b)
233
232
}
234
233
235
234
( _, 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) ?;
237
236
Ok ( a)
238
237
}
239
238
@@ -250,8 +249,6 @@ impl<'tcx> InferCtxt<'tcx> {
250
249
{
251
250
match relation. structurally_relate_aliases ( ) {
252
251
StructurallyRelateAliases :: No => {
253
- let ( a, b) = if relation. a_is_expected ( ) { ( a, b) } else { ( b, a) } ;
254
-
255
252
relation. register_predicates ( [ if self . next_trait_solver ( ) {
256
253
ty:: PredicateKind :: AliasRelate (
257
254
a. into ( ) ,
0 commit comments