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,10 @@ 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
+ let res = ex. tcx ( ) . analysis ( ( ) ) ;
247
+ if res. is_err ( ) {
248
+ FatalError . raise ( ) ;
249
+ }
247
250
}
248
251
249
252
let ( src, src_name) = get_source ( sess) ;
@@ -334,7 +337,10 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
334
337
ThirTree => {
335
338
let tcx = ex. tcx ( ) ;
336
339
let mut out = String :: new ( ) ;
337
- abort_on_err ( rustc_hir_analysis:: check_crate ( tcx) , tcx. sess ) ;
340
+ let res = rustc_hir_analysis:: check_crate ( tcx) ;
341
+ if res. is_err ( ) {
342
+ FatalError . raise ( ) ;
343
+ }
338
344
debug ! ( "pretty printing THIR tree" ) ;
339
345
for did in tcx. hir ( ) . body_owners ( ) {
340
346
let _ = writeln ! ( out, "{:?}:\n {}\n " , did, tcx. thir_tree( did) ) ;
@@ -344,7 +350,10 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
344
350
ThirFlat => {
345
351
let tcx = ex. tcx ( ) ;
346
352
let mut out = String :: new ( ) ;
347
- abort_on_err ( rustc_hir_analysis:: check_crate ( tcx) , tcx. sess ) ;
353
+ let res = rustc_hir_analysis:: check_crate ( tcx) ;
354
+ if res. is_err ( ) {
355
+ FatalError . raise ( ) ;
356
+ }
348
357
debug ! ( "pretty printing THIR flat" ) ;
349
358
for did in tcx. hir ( ) . body_owners ( ) {
350
359
let _ = writeln ! ( out, "{:?}:\n {}\n " , did, tcx. thir_flat( did) ) ;
0 commit comments