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>

source

pub fn new( instance: Instance<'tcx>, function_coverage_info: &'tcx FunctionCoverageInfo ) -> Self

Creates a new set of coverage data for a used (called) function.

source

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.

source

fn create( instance: Instance<'tcx>, function_coverage_info: &'tcx FunctionCoverageInfo, is_used: bool ) -> Self

source

pub(crate) fn mark_counter_id_seen(&mut self, id: CounterId)

Marks a counter ID as having been seen in a counter-increment statement.

source

pub(crate) fn mark_expression_id_seen(&mut self, id: ExpressionId)

Marks an expression ID as having been seen in an expression-used statement.

source

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.

source

pub(crate) fn into_finished(self) -> FunctionCoverage<'tcx>

Trait Implementations§

source§

impl<'tcx> Debug for FunctionCoverageCollector<'tcx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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