Allow rustc_mir_transform to register hook providers

This commit is contained in:
Zalathar 2024-02-08 11:46:26 +11:00
parent 89fab06a77
commit 975109892c
2 changed files with 7 additions and 6 deletions

View File

@ -3,12 +3,12 @@
use rustc_data_structures::captures::Captures;
use rustc_middle::mir::coverage::*;
use rustc_middle::mir::{Body, CoverageIdsInfo};
use rustc_middle::query::Providers;
use rustc_middle::ty::{self};
use rustc_middle::util::Providers;
/// A `query` provider for retrieving coverage information injected into MIR.
/// Registers query/hook implementations related to coverage.
pub(crate) fn provide(providers: &mut Providers) {
providers.coverage_ids_info = |tcx, def_id| coverage_ids_info(tcx, def_id);
providers.queries.coverage_ids_info = coverage_ids_info;
}
/// Query implementation for `coverage_ids_info`.

View File

@ -37,8 +37,9 @@
LocalDecl, MirPass, MirPhase, Operand, Place, ProjectionElem, Promoted, RuntimePhase, Rvalue,
SourceInfo, Statement, StatementKind, TerminatorKind, START_BLOCK,
};
use rustc_middle::query::Providers;
use rustc_middle::query;
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
use rustc_middle::util::Providers;
use rustc_span::{source_map::Spanned, sym, DUMMY_SP};
use rustc_trait_selection::traits;
@ -124,7 +125,7 @@ pub fn provide(providers: &mut Providers) {
ffi_unwind_calls::provide(providers);
shim::provide(providers);
cross_crate_inline::provide(providers);
*providers = Providers {
providers.queries = query::Providers {
mir_keys,
mir_const,
mir_const_qualif,
@ -139,7 +140,7 @@ pub fn provide(providers: &mut Providers) {
mir_inliner_callees: inline::cycle::mir_inliner_callees,
promoted_mir,
deduced_param_attrs: deduce_param_attrs::deduced_param_attrs,
..*providers
..providers.queries
};
}