@@ -345,7 +345,7 @@ impl<'tcx> ClosureSubsts<'tcx> {
345
345
self ,
346
346
def_id : DefId ,
347
347
tcx : TyCtxt < ' _ > ,
348
- ) -> impl Iterator < Item = Ty < ' tcx > > + ' tcx {
348
+ ) -> impl Iterator < Item = Ty < ' tcx > > + ExactSizeIterator + ' tcx {
349
349
let SplitClosureSubsts { upvar_kinds, .. } = self . split ( def_id, tcx) ;
350
350
upvar_kinds. iter ( ) . map ( |t| {
351
351
if let GenericArgKind :: Type ( ty) = t. unpack ( ) {
@@ -433,7 +433,7 @@ impl<'tcx> GeneratorSubsts<'tcx> {
433
433
self ,
434
434
def_id : DefId ,
435
435
tcx : TyCtxt < ' _ > ,
436
- ) -> impl Iterator < Item = Ty < ' tcx > > + ' tcx {
436
+ ) -> impl Iterator < Item = Ty < ' tcx > > + ExactSizeIterator + ' tcx {
437
437
let SplitGeneratorSubsts { upvar_kinds, .. } = self . split ( def_id, tcx) ;
438
438
upvar_kinds. iter ( ) . map ( |t| {
439
439
if let GenericArgKind :: Type ( ty) = t. unpack ( ) {
@@ -551,7 +551,7 @@ impl<'tcx> GeneratorSubsts<'tcx> {
551
551
self ,
552
552
def_id : DefId ,
553
553
tcx : TyCtxt < ' tcx > ,
554
- ) -> impl Iterator < Item = impl Iterator < Item = Ty < ' tcx > > + Captures < ' tcx > > {
554
+ ) -> impl Iterator < Item = impl Iterator < Item = Ty < ' tcx > > + ExactSizeIterator + Captures < ' tcx > > {
555
555
let layout = tcx. generator_layout ( def_id) ;
556
556
layout. variant_fields . iter ( ) . map ( move |variant| {
557
557
variant. iter ( ) . map ( move |field| {
@@ -563,7 +563,9 @@ impl<'tcx> GeneratorSubsts<'tcx> {
563
563
/// This is the types of the fields of a generator which are not stored in a
564
564
/// variant.
565
565
#[ inline]
566
- pub fn prefix_tys ( self , def_id : DefId , tcx : TyCtxt < ' tcx > ) -> impl Iterator < Item = Ty < ' tcx > > {
566
+ pub fn prefix_tys ( self , def_id : DefId , tcx : TyCtxt < ' tcx > )
567
+ -> impl Iterator < Item = Ty < ' tcx > > + ExactSizeIterator
568
+ {
567
569
self . upvar_tys ( def_id, tcx)
568
570
}
569
571
}
@@ -580,7 +582,7 @@ impl<'tcx> UpvarSubsts<'tcx> {
580
582
self ,
581
583
def_id : DefId ,
582
584
tcx : TyCtxt < ' tcx > ,
583
- ) -> impl Iterator < Item = Ty < ' tcx > > + ' tcx {
585
+ ) -> impl Iterator < Item = Ty < ' tcx > > + ExactSizeIterator + ' tcx {
584
586
let upvar_kinds = match self {
585
587
UpvarSubsts :: Closure ( substs) => substs. as_closure ( ) . split ( def_id, tcx) . upvar_kinds ,
586
588
UpvarSubsts :: Generator ( substs) => substs. as_generator ( ) . split ( def_id, tcx) . upvar_kinds ,
0 commit comments