@@ -2051,7 +2051,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
20512051 "assemble_unboxed_candidates: kind={:?} obligation={:?}" ,
20522052 kind, obligation
20532053 ) ;
2054- match self . infcx . closure_kind ( closure_def_id, closure_substs) {
2054+ match self . infcx . closure_kind (
2055+ closure_def_id,
2056+ closure_substs
2057+ ) {
20552058 Some ( closure_kind) => {
20562059 debug ! (
20572060 "assemble_unboxed_candidates: closure_kind = {:?}" ,
@@ -2669,7 +2672,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
26692672 ty:: Closure ( def_id, substs) => {
26702673 // (*) binder moved here
26712674 Where ( ty:: Binder :: bind (
2672- substs. upvar_tys ( def_id, self . tcx ( ) ) . collect ( ) ,
2675+ substs. as_closure ( ) . upvar_tys ( def_id, self . tcx ( ) ) . collect ( ) ,
26732676 ) )
26742677 }
26752678
@@ -2753,7 +2756,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
27532756 tys. iter ( ) . map ( |k| k. expect_ty ( ) ) . collect ( )
27542757 }
27552758
2756- 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 ( ) ,
27572762
27582763 ty:: Generator ( def_id, ref substs, _) => {
27592764 let witness = substs. witness ( def_id, self . tcx ( ) ) ;
@@ -3370,17 +3375,22 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
33703375 ) ?) ;
33713376
33723377 // FIXME: chalk
3378+
33733379 if !self . tcx ( ) . sess . opts . debugging_opts . chalk {
33743380 obligations. push ( Obligation :: new (
33753381 obligation. cause . clone ( ) ,
33763382 obligation. param_env ,
3377- ty:: Predicate :: ClosureKind ( closure_def_id, substs, kind) ,
3383+ ty:: Predicate :: ClosureKind (
3384+ closure_def_id,
3385+ substs,
3386+ kind
3387+ ) ,
33783388 ) ) ;
33793389 }
33803390
33813391 Ok ( VtableClosureData {
33823392 closure_def_id,
3383- substs : substs. clone ( ) ,
3393+ substs : substs,
33843394 nested : obligations,
33853395 } )
33863396 }
@@ -3869,7 +3879,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
38693879 & mut self ,
38703880 obligation : & TraitObligation < ' tcx > ,
38713881 closure_def_id : DefId ,
3872- substs : ty :: ClosureSubsts < ' tcx > ,
3882+ substs : SubstsRef < ' tcx > ,
38733883 ) -> ty:: PolyTraitRef < ' tcx > {
38743884 debug ! (
38753885 "closure_trait_ref_unnormalized(obligation={:?}, closure_def_id={:?}, substs={:?})" ,
0 commit comments