@@ -631,7 +631,9 @@ impl<'a, 'gcx, 'tcx> Struct {
631631
632632 // Perhaps one of the upvars of this closure is non-zero
633633 // Let's recurse and find out!
634- ( _, & ty:: TyClosure ( _, ty:: ClosureSubsts { upvar_tys : tys, .. } ) ) |
634+ ( _, & ty:: TyClosure ( def_id, ref substs) ) => {
635+ Struct :: non_zero_field_path ( infcx, substs. upvar_tys ( def_id, tcx) )
636+ }
635637 // Can we use one of the fields in this tuple?
636638 ( _, & ty:: TyTuple ( tys) ) => {
637639 Struct :: non_zero_field_path ( infcx, tys. iter ( ) . cloned ( ) )
@@ -961,7 +963,13 @@ impl<'a, 'gcx, 'tcx> Layout {
961963 }
962964
963965 // Tuples and closures.
964- ty:: TyClosure ( _, ty:: ClosureSubsts { upvar_tys : tys, .. } ) |
966+ ty:: TyClosure ( def_id, ref substs) => {
967+ let mut st = Struct :: new ( dl, false ) ;
968+ let tys = substs. upvar_tys ( def_id, tcx) ;
969+ st. extend ( dl, tys. map ( |ty| ty. layout ( infcx) ) , ty) ?;
970+ Univariant { variant : st, non_zero : false }
971+ }
972+
965973 ty:: TyTuple ( tys) => {
966974 let mut st = Struct :: new ( dl, false ) ;
967975 st. extend ( dl, tys. iter ( ) . map ( |ty| ty. layout ( infcx) ) , ty) ?;
0 commit comments