@@ -2051,8 +2051,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
2051
2051
"assemble_unboxed_candidates: kind={:?} obligation={:?}" ,
2052
2052
kind, obligation
2053
2053
) ;
2054
- match self . infcx . closure_kind ( closure_def_id,
2055
- ty:: ClosureSubsts :: from_ref ( closure_substs) ) {
2054
+ match self . infcx . closure_kind (
2055
+ closure_def_id,
2056
+ closure_substs
2057
+ ) {
2056
2058
Some ( closure_kind) => {
2057
2059
debug ! (
2058
2060
"assemble_unboxed_candidates: closure_kind = {:?}" ,
@@ -2670,7 +2672,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
2670
2672
ty:: Closure ( def_id, substs) => {
2671
2673
// (*) binder moved here
2672
2674
Where ( ty:: Binder :: bind (
2673
- substs. upvar_tys ( def_id, self . tcx ( ) ) . collect ( ) ,
2675
+ substs. as_closure ( ) . upvar_tys ( def_id, self . tcx ( ) ) . collect ( ) ,
2674
2676
) )
2675
2677
}
2676
2678
@@ -2754,7 +2756,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
2754
2756
tys. iter ( ) . map ( |k| k. expect_ty ( ) ) . collect ( )
2755
2757
}
2756
2758
2757
- ty:: Closure ( def_id, ref substs) => substs. upvar_tys ( def_id, self . tcx ( ) ) . collect ( ) ,
2759
+ ty:: Closure ( def_id, ref substs) => substs. as_closure ( )
2760
+ . upvar_tys ( def_id, self . tcx ( ) )
2761
+ . collect ( ) ,
2758
2762
2759
2763
ty:: Generator ( def_id, ref substs, _) => {
2760
2764
let witness = substs. witness ( def_id, self . tcx ( ) ) ;
@@ -3376,14 +3380,17 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
3376
3380
obligations. push ( Obligation :: new (
3377
3381
obligation. cause . clone ( ) ,
3378
3382
obligation. param_env ,
3379
- ty:: Predicate :: ClosureKind ( closure_def_id,
3380
- ty:: ClosureSubsts :: from_ref ( substs. clone ( ) ) , kind) ,
3383
+ ty:: Predicate :: ClosureKind (
3384
+ closure_def_id,
3385
+ substs,
3386
+ kind
3387
+ ) ,
3381
3388
) ) ;
3382
3389
}
3383
3390
3384
3391
Ok ( VtableClosureData {
3385
3392
closure_def_id,
3386
- substs : ty :: ClosureSubsts :: from_ref ( substs) ,
3393
+ substs : substs,
3387
3394
nested : obligations,
3388
3395
} )
3389
3396
}
@@ -3878,8 +3885,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
3878
3885
"closure_trait_ref_unnormalized(obligation={:?}, closure_def_id={:?}, substs={:?})" ,
3879
3886
obligation, closure_def_id, substs,
3880
3887
) ;
3881
- let closure_type = self . infcx . closure_sig ( closure_def_id,
3882
- ty:: ClosureSubsts :: from_ref ( substs) ) ;
3888
+ let closure_type = self . infcx . closure_sig ( closure_def_id, substs) ;
3883
3889
3884
3890
debug ! (
3885
3891
"closure_trait_ref_unnormalized: closure_type = {:?}" ,
0 commit comments