Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c87dd96

Browse files
authoredJan 19, 2025
Rollup merge of #135708 - compiler-errors:compiler-nits, r=lqd
Some random compiler nits The only "observable" change here is using `par_body_owners` for coroutine witnesses/coroutine obligation checking. r? lqd (or reassign, you just seem to like to approve prs :3 )
2 parents e28e2b8 + 0e98d9a commit c87dd96

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed
 

‎compiler/rustc_hir_typeck/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &UnordSet<LocalDef
8787
}
8888

8989
fn typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
90-
typeck_with_fallback(tcx, def_id, None)
90+
typeck_with_inspect(tcx, def_id, None)
9191
}
9292

9393
/// Same as `typeck` but `inspect` is invoked on evaluation of each root obligation.
@@ -99,11 +99,11 @@ pub fn inspect_typeck<'tcx>(
9999
def_id: LocalDefId,
100100
inspect: ObligationInspector<'tcx>,
101101
) -> &'tcx ty::TypeckResults<'tcx> {
102-
typeck_with_fallback(tcx, def_id, Some(inspect))
102+
typeck_with_inspect(tcx, def_id, Some(inspect))
103103
}
104104

105105
#[instrument(level = "debug", skip(tcx, inspector), ret)]
106-
fn typeck_with_fallback<'tcx>(
106+
fn typeck_with_inspect<'tcx>(
107107
tcx: TyCtxt<'tcx>,
108108
def_id: LocalDefId,
109109
inspector: Option<ObligationInspector<'tcx>>,

‎compiler/rustc_interface/src/passes.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,8 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
875875
});
876876
// Freeze definitions as we don't add new ones at this point.
877877
// We need to wait until now since we synthesize a by-move body
878+
// for all coroutine-closures.
879+
//
878880
// This improves performance by allowing lock-free access to them.
879881
tcx.untracked().definitions.freeze();
880882

@@ -887,7 +889,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
887889
});
888890
});
889891
sess.time("MIR_effect_checking", || {
890-
for def_id in tcx.hir().body_owners() {
892+
tcx.hir().par_body_owners(|def_id| {
891893
tcx.ensure().has_ffi_unwind_calls(def_id);
892894

893895
// If we need to codegen, ensure that we emit all errors from
@@ -898,15 +900,17 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
898900
{
899901
tcx.ensure().mir_drops_elaborated_and_const_checked(def_id);
900902
}
901-
}
903+
});
902904
});
903-
tcx.hir().par_body_owners(|def_id| {
904-
if tcx.is_coroutine(def_id.to_def_id()) {
905-
tcx.ensure().mir_coroutine_witnesses(def_id);
906-
tcx.ensure().check_coroutine_obligations(
907-
tcx.typeck_root_def_id(def_id.to_def_id()).expect_local(),
908-
);
909-
}
905+
sess.time("coroutine_obligations", || {
906+
tcx.hir().par_body_owners(|def_id| {
907+
if tcx.is_coroutine(def_id.to_def_id()) {
908+
tcx.ensure().mir_coroutine_witnesses(def_id);
909+
tcx.ensure().check_coroutine_obligations(
910+
tcx.typeck_root_def_id(def_id.to_def_id()).expect_local(),
911+
);
912+
}
913+
});
910914
});
911915

912916
sess.time("layout_testing", || layout_test::test_layout(tcx));

‎compiler/rustc_middle/src/query/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,7 @@ rustc_queries! {
11641164
}
11651165

11661166
/// Check whether the function has any recursion that could cause the inliner to trigger
1167-
/// a cycle. Returns the call stack causing the cycle. The call stack does not contain the
1168-
/// current function, just all intermediate functions.
1167+
/// a cycle.
11691168
query mir_callgraph_reachable(key: (ty::Instance<'tcx>, LocalDefId)) -> bool {
11701169
fatal_cycle
11711170
desc { |tcx|

0 commit comments

Comments
 (0)
Failed to load comments.