Move methods from Map to TyCtxt, part 2.

Continuing the work started in #136466.

Every method gains a `hir_` prefix, though for the ones that already
have a `par_` or `try_par_` prefix I added the `hir_` after that.
This commit is contained in:
Nicholas Nethercote 2025-02-17 14:17:57 +11:00
parent ce36a966c7
commit fd7b4bf4e1
108 changed files with 314 additions and 346 deletions

View file

@ -20,21 +20,21 @@ use crate::errors::LimitInvalid;
pub(crate) fn provide(providers: &mut Providers) {
providers.limits = |tcx, ()| Limits {
recursion_limit: get_recursion_limit(tcx.hir().krate_attrs(), tcx.sess),
recursion_limit: get_recursion_limit(tcx.hir_krate_attrs(), tcx.sess),
move_size_limit: get_limit(
tcx.hir().krate_attrs(),
tcx.hir_krate_attrs(),
tcx.sess,
sym::move_size_limit,
Limit::new(tcx.sess.opts.unstable_opts.move_size_limit.unwrap_or(0)),
),
type_length_limit: get_limit(
tcx.hir().krate_attrs(),
tcx.hir_krate_attrs(),
tcx.sess,
sym::type_length_limit,
Limit::new(2usize.pow(24)),
),
pattern_complexity_limit: get_limit(
tcx.hir().krate_attrs(),
tcx.hir_krate_attrs(),
tcx.sess,
sym::pattern_complexity_limit,
Limit::unlimited(),

View file

@ -846,7 +846,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
CStore::from_tcx(tcx).report_unused_deps(tcx);
},
{
tcx.hir().par_for_each_module(|module| {
tcx.par_hir_for_each_module(|module| {
tcx.ensure_ok().check_mod_loops(module);
tcx.ensure_ok().check_mod_attrs(module);
tcx.ensure_ok().check_mod_naked_functions(module);
@ -871,7 +871,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
rustc_hir_analysis::check_crate(tcx);
sess.time("MIR_coroutine_by_move_body", || {
tcx.hir().par_body_owners(|def_id| {
tcx.par_hir_body_owners(|def_id| {
if tcx.needs_coroutine_by_move_body_def_id(def_id.to_def_id()) {
tcx.ensure_done().coroutine_by_move_body_def_id(def_id);
}
@ -885,7 +885,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
tcx.untracked().definitions.freeze();
sess.time("MIR_borrow_checking", || {
tcx.hir().par_body_owners(|def_id| {
tcx.par_hir_body_owners(|def_id| {
// Run unsafety check because it's responsible for stealing and
// deallocating THIR.
tcx.ensure_ok().check_unsafety(def_id);
@ -893,21 +893,21 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
});
});
sess.time("MIR_effect_checking", || {
tcx.hir().par_body_owners(|def_id| {
tcx.par_hir_body_owners(|def_id| {
tcx.ensure_ok().has_ffi_unwind_calls(def_id);
// If we need to codegen, ensure that we emit all errors from
// `mir_drops_elaborated_and_const_checked` now, to avoid discovering
// them later during codegen.
if tcx.sess.opts.output_types.should_codegen()
|| tcx.hir().body_const_context(def_id).is_some()
|| tcx.hir_body_const_context(def_id).is_some()
{
tcx.ensure_ok().mir_drops_elaborated_and_const_checked(def_id);
}
});
});
sess.time("coroutine_obligations", || {
tcx.hir().par_body_owners(|def_id| {
tcx.par_hir_body_owners(|def_id| {
if tcx.is_coroutine(def_id.to_def_id()) {
tcx.ensure_ok().mir_coroutine_witnesses(def_id);
tcx.ensure_ok().check_coroutine_obligations(
@ -931,7 +931,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
// that requires the optimized/ctfe MIR, coroutine bodies, or evaluating consts.
if tcx.sess.opts.unstable_opts.validate_mir {
sess.time("ensuring_final_MIR_is_computable", || {
tcx.hir().par_body_owners(|def_id| {
tcx.par_hir_body_owners(|def_id| {
tcx.instance_mir(ty::InstanceKind::Item(def_id.into()));
});
});
@ -967,7 +967,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) {
tcx.ensure_ok().check_private_in_public(());
},
{
tcx.hir().par_for_each_module(|module| {
tcx.par_hir_for_each_module(|module| {
tcx.ensure_ok().check_mod_deathness(module)
});
},
@ -983,7 +983,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) {
},
{
sess.time("privacy_checking_modules", || {
tcx.hir().par_for_each_module(|module| {
tcx.par_hir_for_each_module(|module| {
tcx.ensure_ok().check_mod_privacy(module);
});
});