@@ -1402,19 +1402,15 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1402
1402
}
1403
1403
1404
1404
// provide an impl, but only for suitable `fn` pointers
1405
- ty:: TyFnDef ( .., ty:: Binder ( ty:: FnSig {
1406
- unsafety : hir:: Unsafety :: Normal ,
1407
- abi : Abi :: Rust ,
1408
- variadic : false ,
1409
- ..
1410
- } ) ) |
1411
- ty:: TyFnPtr ( ty:: Binder ( ty:: FnSig {
1412
- unsafety : hir:: Unsafety :: Normal ,
1413
- abi : Abi :: Rust ,
1414
- variadic : false ,
1415
- ..
1416
- } ) ) => {
1417
- candidates. vec . push ( FnPointerCandidate ) ;
1405
+ ty:: TyFnDef ( ..) | ty:: TyFnPtr ( _) => {
1406
+ if let ty:: Binder ( ty:: FnSig {
1407
+ unsafety : hir:: Unsafety :: Normal ,
1408
+ abi : Abi :: Rust ,
1409
+ variadic : false ,
1410
+ ..
1411
+ } ) = self_ty. fn_sig ( self . tcx ( ) ) {
1412
+ candidates. vec . push ( FnPointerCandidate ) ;
1413
+ }
1418
1414
}
1419
1415
1420
1416
_ => { }
@@ -2346,19 +2342,26 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2346
2342
2347
2343
// ok to skip binder; it is reintroduced below
2348
2344
let self_ty = self . infcx . shallow_resolve ( * obligation. self_ty ( ) . skip_binder ( ) ) ;
2349
- let sig = self_ty. fn_sig ( ) ;
2345
+ let sig = self_ty. fn_sig ( self . tcx ( ) ) ;
2350
2346
let trait_ref =
2351
2347
self . tcx ( ) . closure_trait_ref_and_return_type ( obligation. predicate . def_id ( ) ,
2352
2348
self_ty,
2353
2349
sig,
2354
2350
util:: TupleArgumentsFlag :: Yes )
2355
2351
. map_bound ( |( trait_ref, _) | trait_ref) ;
2356
2352
2353
+ let Normalized { value : trait_ref, obligations } =
2354
+ project:: normalize_with_depth ( self ,
2355
+ obligation. param_env ,
2356
+ obligation. cause . clone ( ) ,
2357
+ obligation. recursion_depth + 1 ,
2358
+ & trait_ref) ;
2359
+
2357
2360
self . confirm_poly_trait_refs ( obligation. cause . clone ( ) ,
2358
2361
obligation. param_env ,
2359
2362
obligation. predicate . to_poly_trait_ref ( ) ,
2360
2363
trait_ref) ?;
2361
- Ok ( VtableFnPointerData { fn_ty : self_ty, nested : vec ! [ ] } )
2364
+ Ok ( VtableFnPointerData { fn_ty : self_ty, nested : obligations } )
2362
2365
}
2363
2366
2364
2367
fn confirm_closure_candidate ( & mut self ,
@@ -2797,7 +2800,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2797
2800
substs : ty:: ClosureSubsts < ' tcx > )
2798
2801
-> ty:: PolyTraitRef < ' tcx >
2799
2802
{
2800
- let closure_type = self . infcx . closure_type ( closure_def_id)
2803
+ let closure_type = self . infcx . fn_sig ( closure_def_id)
2801
2804
. subst ( self . tcx ( ) , substs. substs ) ;
2802
2805
let ty:: Binder ( ( trait_ref, _) ) =
2803
2806
self . tcx ( ) . closure_trait_ref_and_return_type ( obligation. predicate . def_id ( ) ,
0 commit comments