diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-12-20 14:08:24 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-12-20 14:09:25 +0000 |
| commit | 701e2f708b95d508f90ffd5a3b234335662ae521 (patch) | |
| tree | eb11e840c219dc7f474ca9757287b01e4887c8ee /compiler/rustc_driver_impl/src/pretty.rs | |
| parent | 8a1f8039a7ded79d3d4fe97b110016d89f2b11e2 (diff) | |
| download | rust-701e2f708b95d508f90ffd5a3b234335662ae521.tar.gz rust-701e2f708b95d508f90ffd5a3b234335662ae521.zip | |
Reduce the amount of explicit FatalError.raise()
Instead use dcx.abort_if_error() or guar.raise_fatal() instead. These guarantee that an error actually happened previously and thus we don't silently abort.
Diffstat (limited to 'compiler/rustc_driver_impl/src/pretty.rs')
| -rw-r--r-- | compiler/rustc_driver_impl/src/pretty.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs index 5a1a873d4bd..93f3d2ab911 100644 --- a/compiler/rustc_driver_impl/src/pretty.rs +++ b/compiler/rustc_driver_impl/src/pretty.rs @@ -4,7 +4,6 @@ use std::cell::Cell; use std::fmt::Write; use rustc_ast_pretty::pprust as pprust_ast; -use rustc_errors::FatalError; use rustc_middle::bug; use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty}; use rustc_middle::ty::{self, TyCtxt}; @@ -311,9 +310,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) { let tcx = ex.tcx(); let mut out = String::new(); rustc_hir_analysis::check_crate(tcx); - if tcx.dcx().has_errors().is_some() { - FatalError.raise(); - } + tcx.dcx().abort_if_errors(); debug!("pretty printing THIR tree"); for did in tcx.hir().body_owners() { let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_tree(did)); @@ -324,9 +321,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) { let tcx = ex.tcx(); let mut out = String::new(); rustc_hir_analysis::check_crate(tcx); - if tcx.dcx().has_errors().is_some() { - FatalError.raise(); - } + tcx.dcx().abort_if_errors(); debug!("pretty printing THIR flat"); for did in tcx.hir().body_owners() { let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_flat(did)); |
