diff options
| author | bors <bors@rust-lang.org> | 2022-03-31 15:20:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-31 15:20:59 +0000 |
| commit | bd1a8692f6260fd59dba1e0fa187092a1c354b2e (patch) | |
| tree | 1de4f925cd61aa8053cf2255465a93ec736f546f /compiler/rustc_interface/src | |
| parent | 03314912f1361af6b39383958b5aa1b4aed61c26 (diff) | |
| parent | 6b099db18cbf252e84ec7035c6f8917a61c3c231 (diff) | |
| download | rust-bd1a8692f6260fd59dba1e0fa187092a1c354b2e.tar.gz rust-bd1a8692f6260fd59dba1e0fa187092a1c354b2e.zip | |
Auto merge of #90204 - cjgillot:owner-pull, r=michaelwoerister
Make lowering pull-based ~Based on https://github.com/rust-lang/rust/pull/90451~ Part of https://github.com/rust-lang/rust/pull/88186 The current lowering code visits all the item-likes in the AST in order, and lowers them one by one. This PR changes it to index the AST and then proceed to lowering on-demand. This is closer to the logic of query-based lowering.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index ea4955e9a54..f2164bccc3e 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -487,12 +487,24 @@ pub fn configure_and_expand( } }); + sess.time("early_lint_checks", || { + let lint_buffer = Some(std::mem::take(resolver.lint_buffer())); + rustc_lint::check_ast_node( + sess, + false, + lint_store, + resolver.registered_tools(), + lint_buffer, + rustc_lint::BuiltinCombinedEarlyLintPass::new(), + &krate, + ) + }); + Ok(krate) } pub fn lower_to_hir<'res, 'tcx>( sess: &'tcx Session, - lint_store: &LintStore, resolver: &'res mut Resolver<'_>, krate: Rc<ast::Crate>, arena: &'tcx rustc_ast_lowering::Arena<'tcx>, @@ -506,19 +518,6 @@ pub fn lower_to_hir<'res, 'tcx>( arena, ); - sess.time("early_lint_checks", || { - let lint_buffer = Some(std::mem::take(resolver.lint_buffer())); - rustc_lint::check_ast_node( - sess, - false, - lint_store, - resolver.registered_tools(), - lint_buffer, - rustc_lint::BuiltinCombinedEarlyLintPass::new(), - &*krate, - ) - }); - // Drop AST to free memory sess.time("drop_ast", || std::mem::drop(krate)); @@ -852,9 +851,8 @@ pub fn create_global_ctxt<'tcx>( dep_graph.assert_ignored(); let sess = &compiler.session(); - let krate = resolver - .borrow_mut() - .access(|resolver| lower_to_hir(sess, &lint_store, resolver, krate, hir_arena)); + let krate = + resolver.borrow_mut().access(|resolver| lower_to_hir(sess, resolver, krate, hir_arena)); let resolver_outputs = BoxedResolver::to_resolver_outputs(resolver); let query_result_on_disk_cache = rustc_incremental::load_query_result_cache(sess); |
