Skip to content

Commit aa1bc58

Browse files
committed
Fix AST pretty.
1 parent 2f28737 commit aa1bc58

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

compiler/rustc_driver/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,12 @@ fn run_compiler(
315315

316316
if let Some(ppm) = &sess.opts.pretty {
317317
if ppm.needs_ast_map() {
318-
let expanded_crate = { &queries.expansion()?.peek().0 };
318+
let expanded_crate = queries.expansion()?.peek().0.clone();
319319
queries.global_ctxt()?.peek_mut().enter(|tcx| {
320320
pretty::print_after_hir_lowering(
321321
tcx,
322322
compiler.input(),
323-
expanded_crate,
323+
&*expanded_crate,
324324
*ppm,
325325
compiler.output_file().as_ref().map(|p| &**p),
326326
);

compiler/rustc_interface/src/passes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,13 @@ pub fn lower_to_hir<'res, 'tcx>(
457457
sess: &'tcx Session,
458458
lint_store: &LintStore,
459459
resolver: &'res mut Resolver<'_>,
460-
krate: ast::Crate,
460+
krate: Rc<ast::Crate>,
461461
arena: &'tcx rustc_ast_lowering::Arena<'tcx>,
462462
) -> &'tcx Crate<'tcx> {
463463
// Lower AST to HIR.
464464
let hir_crate = rustc_ast_lowering::lower_crate(
465465
sess,
466-
&krate,
466+
&*krate,
467467
resolver,
468468
rustc_parse::nt_to_tokenstream,
469469
arena,
@@ -779,7 +779,7 @@ impl<'tcx> QueryContext<'tcx> {
779779
pub fn create_global_ctxt<'tcx>(
780780
compiler: &'tcx Compiler,
781781
lint_store: Lrc<LintStore>,
782-
krate: ast::Crate,
782+
krate: Rc<ast::Crate>,
783783
dep_graph: DepGraph,
784784
resolver: Rc<RefCell<BoxedResolver>>,
785785
outputs: OutputFilenames,

compiler/rustc_interface/src/queries.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub struct Queries<'tcx> {
7979
parse: Query<ast::Crate>,
8080
crate_name: Query<String>,
8181
register_plugins: Query<(ast::Crate, Lrc<LintStore>)>,
82-
expansion: Query<(ast::Crate, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>,
82+
expansion: Query<(Rc<ast::Crate>, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>,
8383
dep_graph: Query<DepGraph>,
8484
prepare_outputs: Query<OutputFilenames>,
8585
global_ctxt: Query<QueryContext<'tcx>>,
@@ -167,7 +167,7 @@ impl<'tcx> Queries<'tcx> {
167167

168168
pub fn expansion(
169169
&self,
170-
) -> Result<&Query<(ast::Crate, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>> {
170+
) -> Result<&Query<(Rc<ast::Crate>, Rc<RefCell<BoxedResolver>>, Lrc<LintStore>)>> {
171171
tracing::trace!("expansion");
172172
self.expansion.compute(|| {
173173
let crate_name = self.crate_name()?.peek().clone();
@@ -183,7 +183,7 @@ impl<'tcx> Queries<'tcx> {
183183
let krate = resolver.access(|resolver| {
184184
passes::configure_and_expand(&sess, &lint_store, krate, &crate_name, resolver)
185185
})?;
186-
Ok((krate, Rc::new(RefCell::new(resolver)), lint_store))
186+
Ok((Rc::new(krate), Rc::new(RefCell::new(resolver)), lint_store))
187187
})
188188
}
189189

0 commit comments

Comments
 (0)