Skip to content

Commit 8a0fdbd

Browse files
committed
Move coroutine_by_move_body_def_id into the big check_crate body owner loop
1 parent b17dba4 commit 8a0fdbd

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
@@ -194,10 +194,10 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
194194
let _: R = tcx.ensure_ok().crate_inherent_impls_overlap_check(());
195195
});
196196

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.
199197
tcx.par_hir_body_owners(|item_def_id| {
200198
let def_kind = tcx.def_kind(item_def_id);
199+
// Make sure we evaluate all static and (non-associated) const items, even if unused.
200+
// If any of these fail to evaluate, we do not want this crate to pass compilation.
201201
match def_kind {
202202
DefKind::Static { .. } => {
203203
tcx.ensure_ok().eval_static_initializer(item_def_id);
@@ -217,6 +217,11 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
217217
if !matches!(def_kind, DefKind::AnonConst) {
218218
tcx.ensure_ok().typeck(item_def_id);
219219
}
220+
// Ensure we generate the new `DefId` before finishing `check_crate`.
221+
// Afterwards we freeze the list of `DefId`s.
222+
if tcx.needs_coroutine_by_move_body_def_id(item_def_id.to_def_id()) {
223+
tcx.ensure_done().coroutine_by_move_body_def_id(item_def_id);
224+
}
220225
});
221226

222227
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
@@ -981,13 +981,6 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
981981
});
982982

983983
rustc_hir_analysis::check_crate(tcx);
984-
sess.time("MIR_coroutine_by_move_body", || {
985-
tcx.par_hir_body_owners(|def_id| {
986-
if tcx.needs_coroutine_by_move_body_def_id(def_id.to_def_id()) {
987-
tcx.ensure_done().coroutine_by_move_body_def_id(def_id);
988-
}
989-
});
990-
});
991984
// Freeze definitions as we don't add new ones at this point.
992985
// We need to wait until now since we synthesize a by-move body
993986
// for all coroutine-closures.

0 commit comments

Comments
 (0)