File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ pub fn compile_input(sess: &Session,
167
167
hir:: check_attr:: check_crate ( sess, & expanded_crate) ;
168
168
} ) ;
169
169
170
- let opt_crate = if keep_ast ( sess ) {
170
+ let opt_crate = if control . keep_ast {
171
171
Some ( & expanded_crate)
172
172
} else {
173
173
drop ( expanded_crate) ;
@@ -263,9 +263,6 @@ fn keep_hygiene_data(sess: &Session) -> bool {
263
263
sess. opts . debugging_opts . keep_hygiene_data
264
264
}
265
265
266
- fn keep_ast ( sess : & Session ) -> bool {
267
- sess. opts . debugging_opts . keep_ast || :: save_analysis ( sess)
268
- }
269
266
270
267
/// The name used for source code that doesn't originate in a file
271
268
/// (e.g. source from stdin or a string)
@@ -304,6 +301,8 @@ pub struct CompileController<'a> {
304
301
pub compilation_done : PhaseController < ' a > ,
305
302
306
303
pub make_glob_map : MakeGlobMap ,
304
+ // Whether the compiler should keep the ast beyond parsing.
305
+ pub keep_ast : bool ,
307
306
}
308
307
309
308
impl < ' a > CompileController < ' a > {
@@ -316,6 +315,7 @@ impl<'a> CompileController<'a> {
316
315
after_llvm : PhaseController :: basic ( ) ,
317
316
compilation_done : PhaseController :: basic ( ) ,
318
317
make_glob_map : MakeGlobMap :: No ,
318
+ keep_ast : false ,
319
319
}
320
320
}
321
321
}
Original file line number Diff line number Diff line change @@ -518,6 +518,8 @@ 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) ;
522
+
521
523
if let Some ( ( ppm, opt_uii) ) = parse_pretty ( sess, matches) {
522
524
if ppm. needs_ast_map ( & opt_uii) {
523
525
control. after_hir_lowering . stop = Compilation :: Stop ;
You can’t perform that action at this time.
0 commit comments