about summary refs log tree commit diff
path: root/compiler/rustc_driver/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-06-11 18:55:30 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2021-06-30 20:53:10 +0200
commit2f28737ebea5a330b9fd95b67d0f5fa6a7dac7cf (patch)
treeff2a4b37a539dba11db90143c1487a8eb17e34d1 /compiler/rustc_driver/src
parentc520cf225310e0d1d3ebf513034255cee3f76e30 (diff)
downloadrust-2f28737ebea5a330b9fd95b67d0f5fa6a7dac7cf.tar.gz
rust-2f28737ebea5a330b9fd95b67d0f5fa6a7dac7cf.zip
Move AST crate.
Diffstat (limited to 'compiler/rustc_driver/src')
-rw-r--r--compiler/rustc_driver/src/lib.rs11
1 files changed, 2 insertions, 9 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
index 35a6495946f..2733cd29909 100644
--- a/compiler/rustc_driver/src/lib.rs
+++ b/compiler/rustc_driver/src/lib.rs
@@ -46,7 +46,6 @@ use std::ffi::OsString;
 use std::fs;
 use std::io::{self, Read, Write};
 use std::lazy::SyncLazy;
-use std::mem;
 use std::panic::{self, catch_unwind};
 use std::path::PathBuf;
 use std::process::{self, Command, Stdio};
@@ -316,12 +315,12 @@ fn run_compiler(
 
             if let Some(ppm) = &sess.opts.pretty {
                 if ppm.needs_ast_map() {
+                    let expanded_crate = { &queries.expansion()?.peek().0 };
                     queries.global_ctxt()?.peek_mut().enter(|tcx| {
-                        let expanded_crate = queries.expansion()?.take().0;
                         pretty::print_after_hir_lowering(
                             tcx,
                             compiler.input(),
-                            &expanded_crate,
+                            expanded_crate,
                             *ppm,
                             compiler.output_file().as_ref().map(|p| &**p),
                         );
@@ -377,12 +376,6 @@ fn run_compiler(
 
             queries.global_ctxt()?;
 
-            // Drop AST after creating GlobalCtxt to free memory
-            {
-                let _timer = sess.prof.generic_activity("drop_ast");
-                mem::drop(queries.expansion()?.take());
-            }
-
             if sess.opts.debugging_opts.no_analysis || sess.opts.debugging_opts.ast_json {
                 return early_exit();
             }