Rollup merge of #73339 - jonas-schievink:unbug, r=estebank

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

Not sure if this might cause any problems later on, but we shouldn't be hitting codegen or const eval for the produced MIR anyways, so it should be fine.

cc https://github.com/rust-lang/rust/issues/72685#issuecomment-643749020
This commit is contained in:
Dylan DPC 2020-06-16 15:08:37 +02:00 committed by GitHub
commit 5bbcdf5f53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>