Don't run generator transform when there's a TyErr

This commit is contained in:
Jonas Schievink 2020-06-14 12:49:41 +02:00
parent 06e47688bf
commit 4004bf1903
1 changed files with 5 additions and 1 deletions

View File

@ -1222,7 +1222,11 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
movability == hir::Movability::Movable,
)
}
_ => bug!(),
_ => {
tcx.sess
.delay_span_bug(body.span, &format!("unexpected generator type {}", gen_ty));
return;
}
};
// Compute GeneratorState<yield_ty, return_ty>