22
33use rustc_ast as ast;
44use rustc_ast_pretty:: pprust as pprust_ast;
5+ use rustc_errors:: FatalError ;
56use rustc_hir as hir;
67use rustc_hir_pretty as pprust_hir;
78use rustc_middle:: bug;
@@ -18,7 +19,6 @@ use std::fmt::Write;
1819
1920pub use self :: PpMode :: * ;
2021pub use self :: PpSourceMode :: * ;
21- use crate :: abort_on_err;
2222
2323struct AstNoAnn ;
2424
@@ -243,7 +243,9 @@ impl<'tcx> PrintExtra<'tcx> {
243243
244244pub fn print < ' tcx > ( sess : & Session , ppm : PpMode , ex : PrintExtra < ' tcx > ) {
245245 if ppm. needs_analysis ( ) {
246- abort_on_err ( ex. tcx ( ) . analysis ( ( ) ) , sess) ;
246+ if ex. tcx ( ) . analysis ( ( ) ) . is_err ( ) {
247+ FatalError . raise ( ) ;
248+ }
247249 }
248250
249251 let ( src, src_name) = get_source ( sess) ;
@@ -334,7 +336,9 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
334336 ThirTree => {
335337 let tcx = ex. tcx ( ) ;
336338 let mut out = String :: new ( ) ;
337- abort_on_err ( rustc_hir_analysis:: check_crate ( tcx) , tcx. sess ) ;
339+ if rustc_hir_analysis:: check_crate ( tcx) . is_err ( ) {
340+ FatalError . raise ( ) ;
341+ }
338342 debug ! ( "pretty printing THIR tree" ) ;
339343 for did in tcx. hir ( ) . body_owners ( ) {
340344 let _ = writeln ! ( out, "{:?}:\n {}\n " , did, tcx. thir_tree( did) ) ;
@@ -344,7 +348,9 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
344348 ThirFlat => {
345349 let tcx = ex. tcx ( ) ;
346350 let mut out = String :: new ( ) ;
347- abort_on_err ( rustc_hir_analysis:: check_crate ( tcx) , tcx. sess ) ;
351+ if rustc_hir_analysis:: check_crate ( tcx) . is_err ( ) {
352+ FatalError . raise ( ) ;
353+ }
348354 debug ! ( "pretty printing THIR flat" ) ;
349355 for did in tcx. hir ( ) . body_owners ( ) {
350356 let _ = writeln ! ( out, "{:?}:\n {}\n " , did, tcx. thir_flat( did) ) ;
0 commit comments