diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 60ed48d8988..05775f37647 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -246,6 +246,8 @@ pub fn ongoing_codegen(&'tcx self) -> Result<&Query>> { // Don't do code generation if there were any errors self.session().compile_status()?; + // If we have any delayed bugs, for example beacuse we created TyKind::Error earlier, + // it's likey that codegen will only cause more ICEs, obscuring the original problem self.session().diagnostic().flush_delayed(); // Hook for UI tests.