@@ -26,7 +26,7 @@ use tracing::{debug, trace, warn};
26
26
pub enum TypeOrVariant < ' tcx > {
27
27
Type ( Ty < ' tcx > ) ,
28
28
Variant ( & ' tcx VariantDef ) ,
29
- GeneratorVariant ( VariantIdx ) ,
29
+ CoroutineVariant ( VariantIdx ) ,
30
30
}
31
31
32
32
/// A struct for storing the data for passing to `codegen_unimplemented`
@@ -132,7 +132,7 @@ impl<'tcx> ProjectedPlace<'tcx> {
132
132
}
133
133
}
134
134
// TODO: handle Variant https://github.com/model-checking/kani/issues/448
135
- TypeOrVariant :: Variant ( _) | TypeOrVariant :: GeneratorVariant ( _) => None ,
135
+ TypeOrVariant :: Variant ( _) | TypeOrVariant :: CoroutineVariant ( _) => None ,
136
136
}
137
137
}
138
138
@@ -205,7 +205,7 @@ impl<'tcx> TypeOrVariant<'tcx> {
205
205
pub fn monomorphize ( self , ctx : & GotocCtx < ' tcx > ) -> Self {
206
206
match self {
207
207
TypeOrVariant :: Type ( t) => TypeOrVariant :: Type ( ctx. monomorphize ( t) ) ,
208
- TypeOrVariant :: Variant ( _) | TypeOrVariant :: GeneratorVariant ( _) => self ,
208
+ TypeOrVariant :: Variant ( _) | TypeOrVariant :: CoroutineVariant ( _) => self ,
209
209
}
210
210
}
211
211
}
@@ -215,8 +215,8 @@ impl<'tcx> TypeOrVariant<'tcx> {
215
215
match self {
216
216
TypeOrVariant :: Type ( t) => * t,
217
217
TypeOrVariant :: Variant ( v) => panic ! ( "expect a type but variant is found: {v:?}" ) ,
218
- TypeOrVariant :: GeneratorVariant ( v) => {
219
- panic ! ( "expect a type but generator variant is found: {v:?}" )
218
+ TypeOrVariant :: CoroutineVariant ( v) => {
219
+ panic ! ( "expect a type but coroutine variant is found: {v:?}" )
220
220
}
221
221
}
222
222
}
@@ -226,8 +226,8 @@ impl<'tcx> TypeOrVariant<'tcx> {
226
226
match self {
227
227
TypeOrVariant :: Type ( t) => panic ! ( "expect a variant but type is found: {t:?}" ) ,
228
228
TypeOrVariant :: Variant ( v) => v,
229
- TypeOrVariant :: GeneratorVariant ( v) => {
230
- panic ! ( "expect a variant but generator variant found {v:?}" )
229
+ TypeOrVariant :: CoroutineVariant ( v) => {
230
+ panic ! ( "expect a variant but coroutine variant found {v:?}" )
231
231
}
232
232
}
233
233
}
@@ -236,7 +236,7 @@ impl<'tcx> TypeOrVariant<'tcx> {
236
236
impl < ' tcx > GotocCtx < ' tcx > {
237
237
/// Codegen field access for types that allow direct field projection.
238
238
///
239
- /// I.e.: Algebraic data types, closures, and generators .
239
+ /// I.e.: Algebraic data types, closures, and coroutines .
240
240
///
241
241
/// Other composite types such as array only support index projection.
242
242
fn codegen_field (
@@ -258,7 +258,7 @@ impl<'tcx> GotocCtx<'tcx> {
258
258
| ty:: FnPtr ( _)
259
259
| ty:: Never
260
260
| ty:: FnDef ( ..)
261
- | ty:: GeneratorWitness ( ..)
261
+ | ty:: CoroutineWitness ( ..)
262
262
| ty:: Foreign ( ..)
263
263
| ty:: Dynamic ( ..)
264
264
| ty:: Bound ( ..)
@@ -283,8 +283,8 @@ impl<'tcx> GotocCtx<'tcx> {
283
283
ty:: Closure ( ..) => {
284
284
Ok ( parent_expr. member ( field. index ( ) . to_string ( ) , & self . symbol_table ) )
285
285
}
286
- ty:: Generator ( ..) => {
287
- let field_name = self . generator_field_name ( field. as_usize ( ) ) ;
286
+ ty:: Coroutine ( ..) => {
287
+ let field_name = self . coroutine_field_name ( field. as_usize ( ) ) ;
288
288
Ok ( parent_expr
289
289
. member ( "direct_fields" , & self . symbol_table )
290
290
. member ( field_name, & self . symbol_table ) )
@@ -301,8 +301,8 @@ impl<'tcx> GotocCtx<'tcx> {
301
301
let field = & parent_var. fields [ * field] ;
302
302
Ok ( parent_expr. member ( field. name . to_string ( ) , & self . symbol_table ) )
303
303
}
304
- TypeOrVariant :: GeneratorVariant ( _var_idx) => {
305
- let field_name = self . generator_field_name ( field. index ( ) ) ;
304
+ TypeOrVariant :: CoroutineVariant ( _var_idx) => {
305
+ let field_name = self . coroutine_field_name ( field. index ( ) ) ;
306
306
Ok ( parent_expr. member ( field_name, & self . symbol_table ) )
307
307
}
308
308
}
@@ -570,11 +570,11 @@ impl<'tcx> GotocCtx<'tcx> {
570
570
let variant = def. variant ( idx) ;
571
571
( variant. name . as_str ( ) . into ( ) , TypeOrVariant :: Variant ( variant) )
572
572
}
573
- ty:: Generator ( ..) => {
574
- ( self . generator_variant_name ( idx) , TypeOrVariant :: GeneratorVariant ( idx) )
573
+ ty:: Coroutine ( ..) => {
574
+ ( self . coroutine_variant_name ( idx) , TypeOrVariant :: CoroutineVariant ( idx) )
575
575
}
576
576
_ => unreachable ! (
577
- "cannot downcast {:?} to a variant (only enums and generators can)" ,
577
+ "cannot downcast {:?} to a variant (only enums and coroutines can)" ,
578
578
& t. kind( )
579
579
) ,
580
580
} ;
@@ -583,7 +583,7 @@ impl<'tcx> GotocCtx<'tcx> {
583
583
Variants :: Single { .. } => before. goto_expr ,
584
584
Variants :: Multiple { tag_encoding, .. } => match tag_encoding {
585
585
TagEncoding :: Direct => {
586
- let cases = if t. is_generator ( ) {
586
+ let cases = if t. is_coroutine ( ) {
587
587
before. goto_expr
588
588
} else {
589
589
before. goto_expr . member ( "cases" , & self . symbol_table )
0 commit comments