Skip to content

Commit cdd545b

Browse files
committed
Auto merge of #141950 - oli-obk:big-body-owner-loop, r=compiler-errors
Move coroutine_by_move_body_def_id into the big check_crate body owner loop This avoids starting a parallel loop in sequence and instead runs all the queries for a specific DefId together.
2 parents 2f2c8c3 + 8a0fdbd commit cdd545b

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
192192
let _: R = tcx.ensure_ok().crate_inherent_impls_overlap_check(());
193193
});
194194

195-
// Make sure we evaluate all static and (non-associated) const items, even if unused.
196-
// If any of these fail to evaluate, we do not want this crate to pass compilation.
197195
tcx.par_hir_body_owners(|item_def_id| {
198196
let def_kind = tcx.def_kind(item_def_id);
197+
// Make sure we evaluate all static and (non-associated) const items, even if unused.
198+
// If any of these fail to evaluate, we do not want this crate to pass compilation.
199199
match def_kind {
200200
DefKind::Static { .. } => {
201201
tcx.ensure_ok().eval_static_initializer(item_def_id);
@@ -215,6 +215,11 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
215215
if !matches!(def_kind, DefKind::AnonConst) {
216216
tcx.ensure_ok().typeck(item_def_id);
217217
}
218+
// Ensure we generate the new `DefId` before finishing `check_crate`.
219+
// Afterwards we freeze the list of `DefId`s.
220+
if tcx.needs_coroutine_by_move_body_def_id(item_def_id.to_def_id()) {
221+
tcx.ensure_done().coroutine_by_move_body_def_id(item_def_id);
222+
}
218223
});
219224

220225
if tcx.features().rustc_attrs() {

compiler/rustc_interface/src/passes.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -976,13 +976,6 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
976976
});
977977

978978
rustc_hir_analysis::check_crate(tcx);
979-
sess.time("MIR_coroutine_by_move_body", || {
980-
tcx.par_hir_body_owners(|def_id| {
981-
if tcx.needs_coroutine_by_move_body_def_id(def_id.to_def_id()) {
982-
tcx.ensure_done().coroutine_by_move_body_def_id(def_id);
983-
}
984-
});
985-
});
986979
// Freeze definitions as we don't add new ones at this point.
987980
// We need to wait until now since we synthesize a by-move body
988981
// for all coroutine-closures.

0 commit comments

Comments
 (0)