Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995

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.

Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
This commit is contained in:
bors 2021-11-09 08:21:10 +00:00
commit 214cd1f228
67 changed files with 486 additions and 211 deletions

View file

@ -468,11 +468,13 @@ crate fn run_global_ctxt(
};
if run {
debug!("running pass {}", p.pass.name);
krate = ctxt.tcx.sess.time(p.pass.name, || (p.pass.run)(krate, &mut ctxt));
krate = tcx.sess.time(p.pass.name, || (p.pass.run)(krate, &mut ctxt));
}
}
ctxt.sess().abort_if_errors();
if tcx.sess.diagnostic().has_errors_or_lint_errors() {
rustc_errors::FatalError.raise();
}
let render_options = ctxt.render_options;
let mut cache = ctxt.cache;