Fix AST pretty.

This commit is contained in:
Camille GILLOT 2021-06-20 18:52:35 +02:00
parent 2f28737ebe
commit aa1bc5874e
3 changed files with 8 additions and 8 deletions

View File

@ -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),
);

View File

@ -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<ast::Crate>,
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<LintStore>,
krate: ast::Crate,
krate: Rc<ast::Crate>,
dep_graph: DepGraph,
resolver: Rc<RefCell<BoxedResolver>>,
outputs: OutputFilenames,

View File

@ -79,7 +79,7 @@ pub struct Queries<'tcx> {
parse: Query<ast::Crate>,
crate_name: Query<String>,
register_plugins: Query<(ast::Crate, Lrc<LintStore>)>,
expansion: Query<(ast::Crate, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>,
expansion: Query<(Rc<ast::Crate>, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>,
dep_graph: Query<DepGraph>,
prepare_outputs: Query<OutputFilenames>,
global_ctxt: Query<QueryContext<'tcx>>,
@ -167,7 +167,7 @@ impl<'tcx> Queries<'tcx> {
pub fn expansion(
&self,
) -> Result<&Query<(ast::Crate, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>> {
) -> Result<&Query<(Rc<ast::Crate>, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>> {
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))
})
}