diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-07-20 23:23:22 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-11-08 01:22:28 +0000 |
| commit | 0ac13bd430cdd433a1b7f5a821fdd538737ae34e (patch) | |
| tree | 2291b3870e1e323ef430e30ffc91f432b9b4344c /compiler/rustc_driver/src/lib.rs | |
| parent | 90a273b785b3bc482b82c4896ba1bdea68745e46 (diff) | |
| download | rust-0ac13bd430cdd433a1b7f5a821fdd538737ae34e.tar.gz rust-0ac13bd430cdd433a1b7f5a821fdd538737ae34e.zip | |
Don't abort compilation after giving a lint error
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
Diffstat (limited to 'compiler/rustc_driver/src/lib.rs')
| -rw-r--r-- | compiler/rustc_driver/src/lib.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 9a57ec99144..47b83290157 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -410,6 +410,10 @@ 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)) })?; |
