From 4004bf19035b5fbe9f552dfafd28ee69f0b234af Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sun, 14 Jun 2020 12:49:41 +0200 Subject: [PATCH] Don't run generator transform when there's a TyErr --- src/librustc_mir/transform/generator.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 25b6a51d91b..acadb5385c9 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -1222,7 +1222,11 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<' movability == hir::Movability::Movable, ) } - _ => bug!(), + _ => { + tcx.sess + .delay_span_bug(body.span, &format!("unexpected generator type {}", gen_ty)); + return; + } }; // Compute GeneratorState