@@ -150,7 +150,8 @@ pub enum TypeVariants<'tcx> {
150
150
/// `|a| a`.
151
151
TyClosure ( DefId , ClosureSubsts < ' tcx > ) ,
152
152
153
- /// The anonymous type of a generator. Pairs with a TyClosure for closure generators.
153
+ /// The anonymous type of a generator. Used to represent the type of
154
+ /// `|a| yield a`.
154
155
TyGenerator ( DefId , ClosureSubsts < ' tcx > , GeneratorInterior < ' tcx > ) ,
155
156
156
157
/// The never type `!`
@@ -280,6 +281,9 @@ impl<'a, 'gcx, 'acx, 'tcx> ClosureSubsts<'tcx> {
280
281
}
281
282
282
283
impl < ' a , ' gcx , ' tcx > ClosureSubsts < ' tcx > {
284
+ /// This returns the types of the MIR locals which had to be stored across suspension points.
285
+ /// It is calculated in rustc_mir::transform::generator::StateTransform.
286
+ /// All the types here must be in the tuple in GeneratorInterior.
283
287
pub fn state_tys ( self , def_id : DefId , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) ->
284
288
impl Iterator < Item =Ty < ' tcx > > + ' tcx
285
289
{
@@ -288,6 +292,8 @@ impl<'a, 'gcx, 'tcx> ClosureSubsts<'tcx> {
288
292
state. into_iter ( )
289
293
}
290
294
295
+ /// This is the types of all the fields stored in a generator.
296
+ /// It includes the upvars, state types and the state discriminant which is u32.
291
297
pub fn field_tys ( self , def_id : DefId , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) ->
292
298
impl Iterator < Item =Ty < ' tcx > > + ' tcx
293
299
{
0 commit comments