diff --git a/compiler/rustc_middle/src/hooks/mod.rs b/compiler/rustc_middle/src/hooks/mod.rs index c70ceef1d47e9..7a69f58d52fae 100644 --- a/compiler/rustc_middle/src/hooks/mod.rs +++ b/compiler/rustc_middle/src/hooks/mod.rs @@ -58,12 +58,6 @@ declare_hooks! { /// Getting a &core::panic::Location referring to a span. hook const_caller_location(file: rustc_span::Symbol, line: u32, col: u32) -> mir::ConstValue; - /// Returns `true` if this def is a function-like thing that is eligible for - /// coverage instrumentation under `-Cinstrument-coverage`. - /// - /// (Eligible functions might nevertheless be skipped for other reasons.) - hook is_eligible_for_coverage(key: LocalDefId) -> bool; - /// Imports all `SourceFile`s from the given crate into the current session. /// This normally happens automatically when we decode a `Span` from /// that crate's metadata - however, the incr comp cache needs diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index fc3094be013bd..05a3c56911285 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -714,6 +714,14 @@ rustc_queries! { separate_provide_extern } + /// Returns `true` if this def is a function-like thing that is eligible for + /// coverage instrumentation under `-Cinstrument-coverage`. + /// + /// (Eligible functions might nevertheless be skipped for other reasons.) + query is_eligible_for_coverage(key: LocalDefId) -> bool { + desc { "checking whether `{}` is eligible for coverage", tcx.def_path_str(key) } + } + /// Checks for the nearest `#[coverage(off)]` or `#[coverage(on)]` on /// this def and any enclosing defs, up to the crate root. /// diff --git a/compiler/rustc_mir_transform/src/coverage/query.rs b/compiler/rustc_mir_transform/src/coverage/query.rs index 39e0769373ede..d0fc31bfa7f70 100644 --- a/compiler/rustc_mir_transform/src/coverage/query.rs +++ b/compiler/rustc_mir_transform/src/coverage/query.rs @@ -14,12 +14,12 @@ use crate::coverage::counters::{CoverageCounters, transcribe_counters}; /// Registers query/hook implementations related to coverage. pub(crate) fn provide(providers: &mut Providers) { - providers.hooks.is_eligible_for_coverage = is_eligible_for_coverage; + providers.queries.is_eligible_for_coverage = is_eligible_for_coverage; providers.queries.coverage_attr_on = coverage_attr_on; providers.queries.coverage_ids_info = coverage_ids_info; } -/// Hook implementation for [`TyCtxt::is_eligible_for_coverage`]. +/// Query implementation for [`TyCtxt::is_eligible_for_coverage`]. fn is_eligible_for_coverage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { // Only instrument functions, methods, and closures (not constants since they are evaluated // at compile time by Miri).