[−][src]Struct rustc_mir::transform::coverage::Instrumentor

pub(in transform::coverage) struct Instrumentor<'a, 'tcx> {
    pass_name: &'a str,
    tcx: TyCtxt<'tcx>,
    mir_body: &'a mut Body<'tcx>,
    body_span: Span,
    basic_coverage_blocks: CoverageGraph,
    coverage_counters: CoverageCounters,
}

Fields

pass_name: &'a strtcx: TyCtxt<'tcx>mir_body: &'a mut Body<'tcx>body_span: Spanbasic_coverage_blocks: CoverageGraphcoverage_counters: CoverageCounters

Implementations

impl<'a, 'tcx> Instrumentor<'a, 'tcx>[src]

pub(in transform::coverage) fn new(
    pass_name: &'a str,
    tcx: TyCtxt<'tcx>,
    mir_body: &'a mut Body<'tcx>
) -> Self
[src]

pub(in transform::coverage) fn inject_counters(
    &'a mut self
)
[src]

pub(in transform::coverage) fn inject_coverage_span_counters(
    &mut self,
    coverage_spans: Vec<CoverageSpan>,
    graphviz_data: &mut GraphvizData,
    debug_used_expressions: &mut UsedExpressions
)
[src]

Inject a counter for each CoverageSpan. There can be multiple CoverageSpans for a given BCB, but only one actual counter needs to be incremented per BCB. bb_counters maps each bcb to its Counter, when injected. Subsequent CoverageSpans for a BCB that already has a Counter will inject an Expression instead, and compute its value by adding ZERO to the BCB Counter value.

If debugging, add every BCB Expression associated with a CoverageSpans to the used_expression_operands map.

pub(in transform::coverage) fn is_code_region_redundant(
    &self,
    bcb: BasicCoverageBlock,
    span: Span,
    body_span: Span
) -> bool
[src]

Returns true if the type of BasicCoverageBlock (specifically, it's BasicBlocks TerminatorKind) with the given Span (relative to the body_span) is known to produce a redundant coverage count.

There is at least one case for this, and if it's not handled, the last line in a function will be double-counted.

If this method returns true, the counter (which other Expressions may depend on) is still injected, but without an associated code region.

pub(in transform::coverage) fn inject_indirect_counters(
    &mut self,
    graphviz_data: &mut GraphvizData,
    debug_used_expressions: &mut UsedExpressions
)
[src]

inject_coverage_span_counters() looped through the CoverageSpans and injected the counter from the CoverageSpans BasicCoverageBlock, removing it from the BCB in the process (via take_counter()).

Any other counter associated with a BasicCoverageBlock, or its incoming edge, but not associated with a CoverageSpan, should only exist if the counter is a Expression dependency (one of the expression operands). Collect them, and inject the additional counters into the MIR, without a reportable coverage span.

pub(in transform::coverage) fn bcb_leader_bb(
    &self,
    bcb: BasicCoverageBlock
) -> BasicBlock
[src]

pub(in transform::coverage) fn bcb_last_bb(
    &self,
    bcb: BasicCoverageBlock
) -> BasicBlock
[src]

pub(in transform::coverage) fn bcb_terminator(
    &self,
    bcb: BasicCoverageBlock
) -> &Terminator<'tcx>
[src]

pub(in transform::coverage) fn bcb_data(
    &self,
    bcb: BasicCoverageBlock
) -> &BasicCoverageBlockData
[src]

pub(in transform::coverage) fn bcb_data_mut(
    &mut self,
    bcb: BasicCoverageBlock
) -> &mut BasicCoverageBlockData
[src]

pub(in transform::coverage) fn format_counter(
    &self,
    counter_kind: &CoverageKind
) -> String
[src]

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for Instrumentor<'a, 'tcx>

impl<'a, 'tcx> !Send for Instrumentor<'a, 'tcx>

impl<'a, 'tcx> !Sync for Instrumentor<'a, 'tcx>

impl<'a, 'tcx> Unpin for Instrumentor<'a, 'tcx> where
    'tcx: 'a, 

impl<'a, 'tcx> !UnwindSafe for Instrumentor<'a, 'tcx>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]