Encode coroutine-closures in SMIR
This commit is contained in:
parent
4a204bebdf
commit
91e74edca0
9 changed files with 137 additions and 4 deletions
|
@ -141,6 +141,10 @@ impl RustcInternal for RigidTy {
|
|||
RigidTy::Coroutine(def, args, _mov) => {
|
||||
rustc_ty::TyKind::Coroutine(def.0.internal(tables, tcx), args.internal(tables, tcx))
|
||||
}
|
||||
RigidTy::CoroutineClosure(def, args) => rustc_ty::TyKind::CoroutineClosure(
|
||||
def.0.internal(tables, tcx),
|
||||
args.internal(tables, tcx),
|
||||
),
|
||||
RigidTy::CoroutineWitness(def, args) => rustc_ty::TyKind::CoroutineWitness(
|
||||
def.0.internal(tables, tcx),
|
||||
args.internal(tables, tcx),
|
||||
|
|
|
@ -107,6 +107,10 @@ impl<'tcx> Tables<'tcx> {
|
|||
stable_mir::ty::CoroutineDef(self.create_def_id(did))
|
||||
}
|
||||
|
||||
pub fn coroutine_closure_def(&mut self, did: DefId) -> stable_mir::ty::CoroutineClosureDef {
|
||||
stable_mir::ty::CoroutineClosureDef(self.create_def_id(did))
|
||||
}
|
||||
|
||||
pub fn alias_def(&mut self, did: DefId) -> stable_mir::ty::AliasDef {
|
||||
stable_mir::ty::AliasDef(self.create_def_id(did))
|
||||
}
|
||||
|
|
|
@ -565,8 +565,11 @@ impl<'tcx> Stable<'tcx> for mir::AggregateKind<'tcx> {
|
|||
tables.tcx.coroutine_movability(*def_id).stable(tables),
|
||||
)
|
||||
}
|
||||
mir::AggregateKind::CoroutineClosure(..) => {
|
||||
todo!("FIXME(async_closures): Lower these to SMIR")
|
||||
mir::AggregateKind::CoroutineClosure(def_id, generic_args) => {
|
||||
stable_mir::mir::AggregateKind::CoroutineClosure(
|
||||
tables.coroutine_closure_def(*def_id),
|
||||
generic_args.stable(tables),
|
||||
)
|
||||
}
|
||||
mir::AggregateKind::RawPtr(ty, mutability) => {
|
||||
stable_mir::mir::AggregateKind::RawPtr(ty.stable(tables), mutability.stable(tables))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue