pub struct FunctionCoverageCollector<'tcx> {
function_coverage_info: &'tcx FunctionCoverageInfo,
is_used: bool,
counters_seen: BitSet<CounterId>,
expressions_seen: BitSet<ExpressionId>,
}
Expand description
Holds all of the coverage mapping data associated with a function instance,
collected during traversal of Coverage
statements in the function’s MIR.
Fields§
§function_coverage_info: &'tcx FunctionCoverageInfo
Coverage info that was attached to this function by the instrumentor.
is_used: bool
§counters_seen: BitSet<CounterId>
Tracks which counters have been seen, so that we can identify mappings to counters that were optimized out, and set them to zero.
expressions_seen: BitSet<ExpressionId>
Contains all expression IDs that have been seen in an ExpressionUsed
coverage statement, plus all expression IDs that aren’t directly used
by any mappings (and therefore do not have expression-used statements).
After MIR traversal is finished, we can conclude that any IDs missing
from this set must have had their statements deleted by MIR opts.
Implementations§
source§impl<'tcx> FunctionCoverageCollector<'tcx>
impl<'tcx> FunctionCoverageCollector<'tcx>
sourcepub fn new(
instance: Instance<'tcx>,
function_coverage_info: &'tcx FunctionCoverageInfo
) -> Self
pub fn new( instance: Instance<'tcx>, function_coverage_info: &'tcx FunctionCoverageInfo ) -> Self
Creates a new set of coverage data for a used (called) function.
sourcepub fn unused(
instance: Instance<'tcx>,
function_coverage_info: &'tcx FunctionCoverageInfo
) -> Self
pub fn unused( instance: Instance<'tcx>, function_coverage_info: &'tcx FunctionCoverageInfo ) -> Self
Creates a new set of coverage data for an unused (never called) function.
fn create( instance: Instance<'tcx>, function_coverage_info: &'tcx FunctionCoverageInfo, is_used: bool ) -> Self
sourcepub(crate) fn mark_counter_id_seen(&mut self, id: CounterId)
pub(crate) fn mark_counter_id_seen(&mut self, id: CounterId)
Marks a counter ID as having been seen in a counter-increment statement.
sourcepub(crate) fn mark_expression_id_seen(&mut self, id: ExpressionId)
pub(crate) fn mark_expression_id_seen(&mut self, id: ExpressionId)
Marks an expression ID as having been seen in an expression-used statement.
sourcefn identify_zero_expressions(&self) -> ZeroExpressions
fn identify_zero_expressions(&self) -> ZeroExpressions
Identify expressions that will always have a value of zero, and note
their IDs in ZeroExpressions
. Mappings that refer to a zero expression
can instead become mappings to a constant zero value.
This method mainly exists to preserve the simplifications that were already being performed by the Rust-side expression renumbering, so that the resulting coverage mappings don’t get worse.
pub(crate) fn into_finished(self) -> FunctionCoverage<'tcx>
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> DynSend for FunctionCoverageCollector<'tcx>
impl<'tcx> DynSync for FunctionCoverageCollector<'tcx>
impl<'tcx> Freeze for FunctionCoverageCollector<'tcx>
impl<'tcx> RefUnwindSafe for FunctionCoverageCollector<'tcx>
impl<'tcx> Send for FunctionCoverageCollector<'tcx>
impl<'tcx> Sync for FunctionCoverageCollector<'tcx>
impl<'tcx> Unpin for FunctionCoverageCollector<'tcx>
impl<'tcx> UnwindSafe for FunctionCoverageCollector<'tcx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Filterable for T
impl<T> Filterable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 80 bytes