@@ -40,7 +40,7 @@ pub struct HrMatchResult<U> {
40
40
}
41
41
42
42
impl < ' a , ' gcx , ' tcx > CombineFields < ' a , ' gcx , ' tcx > {
43
- pub fn higher_ranked_sub < T > ( & self , a : & Binder < T > , b : & Binder < T > )
43
+ pub fn higher_ranked_sub < T > ( & self , a : & Binder < T > , b : & Binder < T > , a_is_expected : bool )
44
44
-> RelateResult < ' tcx , Binder < T > >
45
45
where T : Relate < ' tcx >
46
46
{
@@ -77,11 +77,11 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
77
77
debug ! ( "b_prime={:?}" , b_prime) ;
78
78
79
79
// Compare types now that bound regions have been replaced.
80
- let result = self . sub ( ) . relate ( & a_prime, & b_prime) ?;
80
+ let result = self . sub ( a_is_expected ) . relate ( & a_prime, & b_prime) ?;
81
81
82
82
// Presuming type comparison succeeds, we need to check
83
83
// that the skolemized regions do not "leak".
84
- self . infcx . leak_check ( !self . a_is_expected , span, & skol_map, snapshot) ?;
84
+ self . infcx . leak_check ( !a_is_expected, span, & skol_map, snapshot) ?;
85
85
86
86
// We are finished with the skolemized regions now so pop
87
87
// them off.
@@ -109,7 +109,8 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
109
109
pub fn higher_ranked_match < T , U > ( & self ,
110
110
span : Span ,
111
111
a_pair : & Binder < ( T , U ) > ,
112
- b_match : & T )
112
+ b_match : & T ,
113
+ a_is_expected : bool )
113
114
-> RelateResult < ' tcx , HrMatchResult < U > >
114
115
where T : Relate < ' tcx > ,
115
116
U : TypeFoldable < ' tcx >
@@ -129,7 +130,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
129
130
debug ! ( "higher_ranked_match: skol_map={:?}" , skol_map) ;
130
131
131
132
// Equate types now that bound regions have been replaced.
132
- try!( self . equate ( ) . relate ( & a_match, & b_match) ) ;
133
+ try!( self . equate ( a_is_expected ) . relate ( & a_match, & b_match) ) ;
133
134
134
135
// Map each skolemized region to a vector of other regions that it
135
136
// must be equated with. (Note that this vector may include other
@@ -221,7 +222,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
221
222
} ) ;
222
223
}
223
224
224
- pub fn higher_ranked_lub < T > ( & self , a : & Binder < T > , b : & Binder < T > )
225
+ pub fn higher_ranked_lub < T > ( & self , a : & Binder < T > , b : & Binder < T > , a_is_expected : bool )
225
226
-> RelateResult < ' tcx , Binder < T > >
226
227
where T : Relate < ' tcx >
227
228
{
@@ -239,7 +240,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
239
240
240
241
// Collect constraints.
241
242
let result0 =
242
- self . lub ( ) . relate ( & a_with_fresh, & b_with_fresh) ?;
243
+ self . lub ( a_is_expected ) . relate ( & a_with_fresh, & b_with_fresh) ?;
243
244
let result0 =
244
245
self . infcx . resolve_type_vars_if_possible ( & result0) ;
245
246
debug ! ( "lub result0 = {:?}" , result0) ;
@@ -311,7 +312,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
311
312
}
312
313
}
313
314
314
- pub fn higher_ranked_glb < T > ( & self , a : & Binder < T > , b : & Binder < T > )
315
+ pub fn higher_ranked_glb < T > ( & self , a : & Binder < T > , b : & Binder < T > , a_is_expected : bool )
315
316
-> RelateResult < ' tcx , Binder < T > >
316
317
where T : Relate < ' tcx >
317
318
{
@@ -333,7 +334,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
333
334
334
335
// Collect constraints.
335
336
let result0 =
336
- self . glb ( ) . relate ( & a_with_fresh, & b_with_fresh) ?;
337
+ self . glb ( a_is_expected ) . relate ( & a_with_fresh, & b_with_fresh) ?;
337
338
let result0 =
338
339
self . infcx . resolve_type_vars_if_possible ( & result0) ;
339
340
debug ! ( "glb result0 = {:?}" , result0) ;
0 commit comments