@@ -518,7 +518,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
518
518
-> CompileController < ' a > {
519
519
let mut control = CompileController :: basic ( ) ;
520
520
521
- control. keep_ast = sess. opts . debugging_opts . keep_ast || save_analysis ( sess ) ;
521
+ control. keep_ast = sess. opts . debugging_opts . keep_ast ;
522
522
523
523
if let Some ( ( ppm, opt_uii) ) = parse_pretty ( sess, matches) {
524
524
if ppm. needs_ast_map ( & opt_uii) {
@@ -574,19 +574,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
574
574
}
575
575
576
576
if save_analysis ( sess) {
577
- control. after_analysis . callback = box |state| {
578
- time ( state. session . time_passes ( ) , "save analysis" , || {
579
- save:: process_crate ( state. tcx . unwrap ( ) ,
580
- state. expanded_crate . unwrap ( ) ,
581
- state. analysis . unwrap ( ) ,
582
- state. crate_name . unwrap ( ) ,
583
- None ,
584
- DumpHandler :: new ( state. out_dir ,
585
- state. crate_name . unwrap ( ) ) )
586
- } ) ;
587
- } ;
588
- control. after_analysis . run_callback_on_error = true ;
589
- control. make_glob_map = resolve:: MakeGlobMap :: Yes ;
577
+ enable_save_analysis ( & mut control) ;
590
578
}
591
579
592
580
if sess. print_fuel_crate . is_some ( ) {
@@ -603,6 +591,23 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
603
591
}
604
592
}
605
593
594
+ pub fn enable_save_analysis ( control : & mut CompileController ) {
595
+ control. keep_ast = true ;
596
+ control. after_analysis . callback = box |state| {
597
+ time ( state. session . time_passes ( ) , "save analysis" , || {
598
+ save:: process_crate ( state. tcx . unwrap ( ) ,
599
+ state. expanded_crate . unwrap ( ) ,
600
+ state. analysis . unwrap ( ) ,
601
+ state. crate_name . unwrap ( ) ,
602
+ None ,
603
+ DumpHandler :: new ( state. out_dir ,
604
+ state. crate_name . unwrap ( ) ) )
605
+ } ) ;
606
+ } ;
607
+ control. after_analysis . run_callback_on_error = true ;
608
+ control. make_glob_map = resolve:: MakeGlobMap :: Yes ;
609
+ }
610
+
606
611
fn save_analysis ( sess : & Session ) -> bool {
607
612
sess. opts . debugging_opts . save_analysis
608
613
}
@@ -1215,7 +1220,7 @@ pub fn diagnostics_registry() -> errors::registry::Registry {
1215
1220
Registry :: new ( & all_errors)
1216
1221
}
1217
1222
1218
- fn get_args ( ) -> Vec < String > {
1223
+ pub fn get_args ( ) -> Vec < String > {
1219
1224
env:: args_os ( ) . enumerate ( )
1220
1225
. map ( |( i, arg) | arg. into_string ( ) . unwrap_or_else ( |arg| {
1221
1226
early_error ( ErrorOutputType :: default ( ) ,
0 commit comments