2
2
3
3
use rustc_ast as ast;
4
4
use rustc_ast_pretty:: pprust as pprust_ast;
5
+ use rustc_errors:: FatalError ;
5
6
use rustc_hir as hir;
6
7
use rustc_hir_pretty as pprust_hir;
7
8
use rustc_middle:: bug;
@@ -18,7 +19,6 @@ use std::fmt::Write;
18
19
19
20
pub use self :: PpMode :: * ;
20
21
pub use self :: PpSourceMode :: * ;
21
- use crate :: abort_on_err;
22
22
23
23
struct AstNoAnn ;
24
24
@@ -243,7 +243,9 @@ impl<'tcx> PrintExtra<'tcx> {
243
243
244
244
pub fn print < ' tcx > ( sess : & Session , ppm : PpMode , ex : PrintExtra < ' tcx > ) {
245
245
if ppm. needs_analysis ( ) {
246
- abort_on_err ( ex. tcx ( ) . analysis ( ( ) ) , sess) ;
246
+ if ex. tcx ( ) . analysis ( ( ) ) . is_err ( ) {
247
+ FatalError . raise ( ) ;
248
+ }
247
249
}
248
250
249
251
let ( src, src_name) = get_source ( sess) ;
@@ -334,7 +336,9 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
334
336
ThirTree => {
335
337
let tcx = ex. tcx ( ) ;
336
338
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
+ }
338
342
debug ! ( "pretty printing THIR tree" ) ;
339
343
for did in tcx. hir ( ) . body_owners ( ) {
340
344
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>) {
344
348
ThirFlat => {
345
349
let tcx = ex. tcx ( ) ;
346
350
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
+ }
348
354
debug ! ( "pretty printing THIR flat" ) ;
349
355
for did in tcx. hir ( ) . body_owners ( ) {
350
356
let _ = writeln ! ( out, "{:?}:\n {}\n " , did, tcx. thir_flat( did) ) ;
0 commit comments