diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 2733cd29909..20f1e192a61 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -315,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 }; + let expanded_crate = queries.expansion()?.peek().0.clone(); queries.global_ctxt()?.peek_mut().enter(|tcx| { pretty::print_after_hir_lowering( tcx, compiler.input(), - expanded_crate, + &*expanded_crate, *ppm, compiler.output_file().as_ref().map(|p| &**p), ); diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 98394bee22c..63aa3db63ff 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -457,13 +457,13 @@ pub fn lower_to_hir<'res, 'tcx>( sess: &'tcx Session, lint_store: &LintStore, resolver: &'res mut Resolver<'_>, - krate: ast::Crate, + krate: Rc, arena: &'tcx rustc_ast_lowering::Arena<'tcx>, ) -> &'tcx Crate<'tcx> { // Lower AST to HIR. let hir_crate = rustc_ast_lowering::lower_crate( sess, - &krate, + &*krate, resolver, rustc_parse::nt_to_tokenstream, arena, @@ -779,7 +779,7 @@ impl<'tcx> QueryContext<'tcx> { pub fn create_global_ctxt<'tcx>( compiler: &'tcx Compiler, lint_store: Lrc, - krate: ast::Crate, + krate: Rc, dep_graph: DepGraph, resolver: Rc>, outputs: OutputFilenames, diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index b5fe8af1fd7..8a0964e6b9f 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -79,7 +79,7 @@ pub struct Queries<'tcx> { parse: Query, crate_name: Query, register_plugins: Query<(ast::Crate, Lrc)>, - expansion: Query<(ast::Crate, Rc>, Lrc)>, + expansion: Query<(Rc, Rc>, Lrc)>, dep_graph: Query, prepare_outputs: Query, global_ctxt: Query>, @@ -167,7 +167,7 @@ impl<'tcx> Queries<'tcx> { pub fn expansion( &self, - ) -> Result<&Query<(ast::Crate, Rc>, Lrc)>> { + ) -> Result<&Query<(Rc, Rc>, Lrc)>> { tracing::trace!("expansion"); self.expansion.compute(|| { let crate_name = self.crate_name()?.peek().clone(); @@ -183,7 +183,7 @@ impl<'tcx> Queries<'tcx> { let krate = resolver.access(|resolver| { passes::configure_and_expand(&sess, &lint_store, krate, &crate_name, resolver) })?; - Ok((krate, Rc::new(RefCell::new(resolver)), lint_store)) + Ok((Rc::new(krate), Rc::new(RefCell::new(resolver)), lint_store)) }) }