Skip to content

Commit

Permalink
Unrolled build for rust-lang#135708
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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 )
  • Loading branch information
rust-timer authored Jan 19, 2025
2 parents 01706e1 + 0e98d9a commit b6b970f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &UnordSet<LocalDef
}

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

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

#[instrument(level = "debug", skip(tcx, inspector), ret)]
fn typeck_with_fallback<'tcx>(
fn typeck_with_inspect<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
inspector: Option<ObligationInspector<'tcx>>,
Expand Down
22 changes: 13 additions & 9 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
});
// Freeze definitions as we don't add new ones at this point.
// We need to wait until now since we synthesize a by-move body
// for all coroutine-closures.
//
// This improves performance by allowing lock-free access to them.
tcx.untracked().definitions.freeze();

Expand All @@ -887,7 +889,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
});
});
sess.time("MIR_effect_checking", || {
for def_id in tcx.hir().body_owners() {
tcx.hir().par_body_owners(|def_id| {
tcx.ensure().has_ffi_unwind_calls(def_id);

// If we need to codegen, ensure that we emit all errors from
Expand All @@ -898,15 +900,17 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
{
tcx.ensure().mir_drops_elaborated_and_const_checked(def_id);
}
}
});
});
tcx.hir().par_body_owners(|def_id| {
if tcx.is_coroutine(def_id.to_def_id()) {
tcx.ensure().mir_coroutine_witnesses(def_id);
tcx.ensure().check_coroutine_obligations(
tcx.typeck_root_def_id(def_id.to_def_id()).expect_local(),
);
}
sess.time("coroutine_obligations", || {
tcx.hir().par_body_owners(|def_id| {
if tcx.is_coroutine(def_id.to_def_id()) {
tcx.ensure().mir_coroutine_witnesses(def_id);
tcx.ensure().check_coroutine_obligations(
tcx.typeck_root_def_id(def_id.to_def_id()).expect_local(),
);
}
});
});

sess.time("layout_testing", || layout_test::test_layout(tcx));
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,7 @@ rustc_queries! {
}

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

0 comments on commit b6b970f

Please sign in to comment.