From c008bb0012e11804c64ed6605dbfb06705c805b3 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 22 Jul 2021 23:47:46 +0000 Subject: [PATCH] Don't proceed to codegen if there are lint errors --- compiler/rustc_driver/src/lib.rs | 4 ---- compiler/rustc_session/src/session.rs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 47b83290157..9a57ec99144 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -410,10 +410,6 @@ fn run_compiler( sess.code_stats.print_type_sizes(); } - if sess.diagnostic().has_errors_or_lint_errors() { - return Err(ErrorReported); - } - let linker = queries.linker()?; Ok(Some(linker)) })?; diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 0f6a3ddccba..74b3cfa44c3 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -411,7 +411,7 @@ pub fn abort_if_errors(&self) { self.diagnostic().abort_if_errors(); } pub fn compile_status(&self) -> Result<(), ErrorReported> { - if self.has_errors() { + if self.diagnostic().has_errors_or_lint_errors() { self.diagnostic().emit_stashed_diagnostics(); Err(ErrorReported) } else {