pub(crate) 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(crate) fn new(
instance: Instance<'tcx>,
function_coverage_info: &'tcx FunctionCoverageInfo,
) -> Self
pub(crate) fn new( instance: Instance<'tcx>, function_coverage_info: &'tcx FunctionCoverageInfo, ) -> Self
Creates a new set of coverage data for a used (called) function.
Sourcepub(crate) fn unused(
instance: Instance<'tcx>,
function_coverage_info: &'tcx FunctionCoverageInfo,
) -> Self
pub(crate) 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
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> 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