diff options
| author | bors <bors@rust-lang.org> | 2021-10-01 20:06:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-01 20:06:34 +0000 |
| commit | c02371c442f811878ab3a0f5a813402b6dfd45d2 (patch) | |
| tree | e293105dba102078f3039dba3ddc4f82f7c6c6bb /compiler/rustc_interface/src | |
| parent | b6057bf7b7ee7c58e6a39ead02eaa13b75f908c2 (diff) | |
| parent | 77c300285c0528241b2b08823167598739fc0f82 (diff) | |
| download | rust-c02371c442f811878ab3a0f5a813402b6dfd45d2.tar.gz rust-c02371c442f811878ab3a0f5a813402b6dfd45d2.zip | |
Auto merge of #88880 - cjgillot:no-krate, r=oli-obk
Rework HIR API to make invocations of the hir_crate query harder. `hir_crate` forces the recomputation of queries that depend on it. This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/proc_macro_decls.rs | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 55a3fcd0266..25a110e0297 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -886,9 +886,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { parallel!( { sess.time("match_checking", || { - tcx.par_body_owners(|def_id| { - tcx.ensure().check_match(def_id.to_def_id()); - }); + tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id.to_def_id())) }); }, { @@ -907,11 +905,11 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> { }); sess.time("MIR_borrow_checking", || { - tcx.par_body_owners(|def_id| tcx.ensure().mir_borrowck(def_id)); + tcx.hir().par_body_owners(|def_id| tcx.ensure().mir_borrowck(def_id)); }); sess.time("MIR_effect_checking", || { - for def_id in tcx.body_owners() { + for def_id in tcx.hir().body_owners() { tcx.ensure().thir_check_unsafety(def_id); if !tcx.sess.opts.debugging_opts.thir_unsafeck { rustc_mir_transform::check_unsafety::check_unsafety(tcx, def_id); diff --git a/compiler/rustc_interface/src/proc_macro_decls.rs b/compiler/rustc_interface/src/proc_macro_decls.rs index 88cf6275ebb..c0316ce58d2 100644 --- a/compiler/rustc_interface/src/proc_macro_decls.rs +++ b/compiler/rustc_interface/src/proc_macro_decls.rs @@ -7,7 +7,7 @@ use rustc_span::symbol::sym; fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> { let mut finder = Finder { tcx, decls: None }; - tcx.hir().krate().visit_all_item_likes(&mut finder); + tcx.hir().visit_all_item_likes(&mut finder); finder.decls.map(|id| tcx.hir().local_def_id(id)) } |
