diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 7cafc05e3908..c945de8f1e1d 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -393,9 +393,6 @@ pub fn run_compiler( queries.ongoing_codegen()?; - // Drop GlobalCtxt after starting codegen to free memory - mem::drop(queries.global_ctxt()?.take()); - if sess.opts.debugging_opts.print_type_sizes { sess.code_stats.print_type_sizes(); } diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index ba855ef2f856..3b03cfc12bc1 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -317,7 +317,7 @@ impl Linker { impl Compiler { pub fn enter(&self, f: F) -> T - where F: for<'q> FnOnce(&'q Queries<'_>) -> T + where F: FnOnce(&Queries<'_>) -> T { let queries = Queries::new(&self); f(&queries) @@ -345,9 +345,6 @@ impl Compiler { queries.ongoing_codegen()?; - // Drop GlobalCtxt after starting codegen to free memory. - mem::drop(queries.global_ctxt()?.take()); - let linker = queries.linker()?; Ok(Some(linker)) })?; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index d9d475813b07..7d1f89079f80 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -343,7 +343,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt registry: rustc_driver::diagnostics_registry(), }; - interface::run_compiler_in_existing_thread_pool(config, |compiler| { compiler.enter(|queries| { + interface::run_compiler_in_existing_thread_pool(config, |compiler| compiler.enter(|queries| { let sess = compiler.session(); // We need to hold on to the complete resolver, so we cause everything to be @@ -487,7 +487,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt (krate, ctxt.renderinfo.into_inner(), render_options) }) - }) }) + })) } /// `DefId` or parameter index (`ty::ParamTy.index`) of a synthetic type parameter diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 4cb97ccb0bf6..44d3dac16606 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -85,7 +85,7 @@ pub fn run(options: Options) -> i32 { let mut test_args = options.test_args.clone(); let display_warnings = options.display_warnings; - let tests = interface::run_compiler(config, |compiler| { compiler.enter(|queries| { + let tests = interface::run_compiler(config, |compiler| compiler.enter(|queries| { let lower_to_hir = queries.lower_to_hir()?; let mut opts = scrape_test_config(lower_to_hir.peek().0.borrow().krate()); @@ -119,7 +119,7 @@ pub fn run(options: Options) -> i32 { let ret : Result<_, ErrorReported> = Ok(collector.tests); ret - }) }).expect("compiler aborted in rustdoc!"); + })).expect("compiler aborted in rustdoc!"); test_args.insert(0, "rustdoctest".to_string());