What even is CoroutineInfo
This commit is contained in:
parent
3004e8c44b
commit
07b7c77705
@ -244,18 +244,23 @@ pub fn def_id(&self) -> DefId {
|
||||
}
|
||||
}
|
||||
|
||||
/// Additional information carried by a MIR body when it is lowered from a coroutine.
|
||||
/// This information is modified as it is lowered during the `StateTransform` MIR pass,
|
||||
/// so not all fields will be active at a given time. For example, the `yield_ty` is
|
||||
/// taken out of the field after yields are turned into returns, and the `coroutine_drop`
|
||||
/// body is only populated after the state transform pass.
|
||||
#[derive(Clone, TyEncodable, TyDecodable, Debug, HashStable, TypeFoldable, TypeVisitable)]
|
||||
pub struct CoroutineInfo<'tcx> {
|
||||
/// The yield type of the function, if it is a coroutine.
|
||||
/// The yield type of the function. This field is removed after the state transform pass.
|
||||
pub yield_ty: Option<Ty<'tcx>>,
|
||||
|
||||
/// The resume type of the function, if it is a coroutine.
|
||||
/// The resume type of the function. This field is removed after the state transform pass.
|
||||
pub resume_ty: Option<Ty<'tcx>>,
|
||||
|
||||
/// Coroutine drop glue.
|
||||
/// Coroutine drop glue. This field is populated after the state transform pass.
|
||||
pub coroutine_drop: Option<Body<'tcx>>,
|
||||
|
||||
/// The layout of a coroutine. Produced by the state transformation.
|
||||
/// The layout of a coroutine. This field is populated after the state transform pass.
|
||||
pub coroutine_layout: Option<CoroutineLayout<'tcx>>,
|
||||
|
||||
/// If this is a coroutine then record the type of source expression that caused this coroutine
|
||||
@ -303,6 +308,12 @@ pub struct Body<'tcx> {
|
||||
/// and used for debuginfo. Indexed by a `SourceScope`.
|
||||
pub source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
|
||||
|
||||
/// Additional information carried by a MIR body when it is lowered from a coroutine.
|
||||
///
|
||||
/// Note that the coroutine drop shim, any promoted consts, and other synthetic MIR
|
||||
/// bodies that come from processing a coroutine body are not typically coroutines
|
||||
/// themselves, and should probably set this to `None` to avoid carrying redundant
|
||||
/// information.
|
||||
pub coroutine: Option<Box<CoroutineInfo<'tcx>>>,
|
||||
|
||||
/// Declarations of locals.
|
||||
|
Loading…
Reference in New Issue
Block a user