1
Fork 0

More comments, final tweaks

This commit is contained in:
Michael Goulet 2024-01-25 19:17:21 +00:00
parent 37184e86ea
commit c98d6994a3
20 changed files with 169 additions and 42 deletions

View file

@ -646,9 +646,16 @@ impl<'tcx> Instance<'tcx> {
bug!()
};
// If the closure's kind ty disagrees with the identity closure's kind ty,
// then this must be a coroutine generated by one of the `ConstructCoroutineInClosureShim`s.
if args.as_coroutine().kind_ty() == id_args.as_coroutine().kind_ty() {
Some(Instance { def: ty::InstanceDef::Item(coroutine_def_id), args })
} else {
assert_eq!(
args.as_coroutine().kind_ty().to_opt_closure_kind().unwrap(),
ty::ClosureKind::FnOnce,
"FIXME(async_closures): Generate a by-mut body here."
);
Some(Instance {
def: ty::InstanceDef::CoroutineByMoveShim { coroutine_def_id },
args,