This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ impl<'tcx> ty::CoroutineArgs<TyCtxt<'tcx>> {
6868 const RETURNED : usize = 1 ;
6969 /// Coroutine has been poisoned.
7070 const POISONED : usize = 2 ;
71+ /// Number of variants to reserve in coroutine state. Corresponds to
72+ /// `UNRESUMED` (beginning of a coroutine) and `RETURNED`/`POISONED`
73+ /// (end of a coroutine) states.
74+ const RESERVED_VARIANTS : usize = 3 ;
7175
7276 const UNRESUMED_NAME : & ' static str = "Unresumed" ;
7377 const RETURNED_NAME : & ' static str = "Returned" ;
@@ -116,7 +120,7 @@ impl<'tcx> ty::CoroutineArgs<TyCtxt<'tcx>> {
116120 Self :: UNRESUMED => Cow :: from ( Self :: UNRESUMED_NAME ) ,
117121 Self :: RETURNED => Cow :: from ( Self :: RETURNED_NAME ) ,
118122 Self :: POISONED => Cow :: from ( Self :: POISONED_NAME ) ,
119- _ => Cow :: from ( format ! ( "Suspend{}" , v. as_usize( ) - 3 ) ) ,
123+ _ => Cow :: from ( format ! ( "Suspend{}" , v. as_usize( ) - Self :: RESERVED_VARIANTS ) ) ,
120124 }
121125 }
122126
Original file line number Diff line number Diff line change @@ -208,11 +208,8 @@ const UNRESUMED: usize = CoroutineArgs::UNRESUMED;
208208const RETURNED : usize = CoroutineArgs :: RETURNED ;
209209/// Coroutine has panicked and is poisoned.
210210const POISONED : usize = CoroutineArgs :: POISONED ;
211-
212- /// Number of variants to reserve in coroutine state. Corresponds to
213- /// `UNRESUMED` (beginning of a coroutine) and `RETURNED`/`POISONED`
214- /// (end of a coroutine) states.
215- const RESERVED_VARIANTS : usize = 3 ;
211+ /// Number of reserved variants of coroutine state.
212+ const RESERVED_VARIANTS : usize = CoroutineArgs :: RESERVED_VARIANTS ;
216213
217214/// A `yield` point in the coroutine.
218215struct SuspensionPoint < ' tcx > {
You can’t perform that action at this time.
0 commit comments