@@ -191,7 +191,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
191
191
// we have no information about the source type. This will always
192
192
// ultimately fall back to some form of subtyping.
193
193
if a. is_ty_var ( ) {
194
- return self . coerce_from_inference_variable ( a, b, identity ) ;
194
+ return self . coerce_from_inference_variable ( a, b) ;
195
195
}
196
196
197
197
// Consider coercing the subtype to a DST
@@ -265,12 +265,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
265
265
/// Coercing *from* an inference variable. In this case, we have no information
266
266
/// about the source type, so we can't really do a true coercion and we always
267
267
/// fall back to subtyping (`unify_and`).
268
- fn coerce_from_inference_variable (
269
- & self ,
270
- a : Ty < ' tcx > ,
271
- b : Ty < ' tcx > ,
272
- make_adjustments : impl FnOnce ( Ty < ' tcx > ) -> Vec < Adjustment < ' tcx > > ,
273
- ) -> CoerceResult < ' tcx > {
268
+ fn coerce_from_inference_variable ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> CoerceResult < ' tcx > {
274
269
debug ! ( "coerce_from_inference_variable(a={:?}, b={:?})" , a, b) ;
275
270
assert ! ( a. is_ty_var( ) && self . shallow_resolve( a) == a) ;
276
271
assert ! ( self . shallow_resolve( b) == b) ;
@@ -298,12 +293,11 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
298
293
"coerce_from_inference_variable: two inference variables, target_ty={:?}, obligations={:?}" ,
299
294
target_ty, obligations
300
295
) ;
301
- let adjustments = make_adjustments ( target_ty) ;
302
- InferResult :: Ok ( InferOk { value : ( adjustments, target_ty) , obligations } )
296
+ success ( vec ! [ ] , target_ty, obligations)
303
297
} else {
304
298
// One unresolved type variable: just apply subtyping, we may be able
305
299
// to do something useful.
306
- self . unify_and ( a, b, make_adjustments )
300
+ self . unify_and ( a, b, identity )
307
301
}
308
302
}
309
303
@@ -708,7 +702,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
708
702
&& let ty:: Dynamic ( b_data, _, ty:: DynStar ) = b. kind ( )
709
703
&& a_data. principal_def_id ( ) == b_data. principal_def_id ( )
710
704
{
711
- return self . unify_and ( a, b, |_| vec ! [ ] ) ;
705
+ return self . unify_and ( a, b, identity ) ;
712
706
}
713
707
714
708
// Check the obligations of the cast -- for example, when casting
@@ -808,9 +802,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
808
802
809
803
// To complete the reborrow, we need to make sure we can unify the inner types, and if so we
810
804
// add the adjustments.
811
- self . unify_and ( a, b, |_inner_ty| {
812
- vec ! [ Adjustment { kind: Adjust :: ReborrowPin ( mut_b) , target: b } ]
813
- } )
805
+ self . unify_and ( a, b, simple ( Adjust :: ReborrowPin ( mut_b) ) )
814
806
}
815
807
816
808
fn coerce_from_safe_fn (
0 commit comments