[−][src]Struct rustc_mir::transform::instrument_coverage::BasicCoverageBlock
A BasicCoverageBlock (BCB) represents the maximal-length sequence of CFG (MIR) BasicBlocks without conditional branches.
The BCB allows coverage analysis to be performed on a simplified projection of the underlying
MIR CFG, without altering the original CFG. Note that running the MIR SimplifyCfg transform,
is not sufficient, and therefore not necessary, since the BCB-based CFG projection is a more
aggressive simplification. For example:
- The BCB CFG projection ignores (trims) branches not relevant to coverage, such as unwind-
related code that is injected by the Rust compiler but has no physical source code to
count. This also means a BasicBlock with a
Callterminator can be merged into its primary successor target block, in the same BCB. - Some BasicBlock terminators support Rust-specific concerns--like borrow-checking--that are
not relevant to coverage analysis.
FalseUnwind, for example, can be treated the same as aGoto, and merged with its successor into the same BCB.
Each BCB with at least one computed CoverageSpan will have no more than one Counter.
In some cases, a BCB's execution count can be computed by CounterExpression. Additional
disjoint CoverageSpans in a BCB can also be counted by CounterExpression (by adding ZERO
to the BCB's primary counter or expression).
Dominator/dominated relationships (which are fundamental to the coverage analysis algorithm)
between two BCBs can be computed using the mir::Body dominators() with any BasicBlock
member of each BCB. (For consistency, BCB's use the first BasicBlock, also referred to as the
bcb_leader_bb.)
The BCB CFG projection is critical to simplifying the coverage analysis by ensuring graph
path-based queries (is_dominated_by(), predecessors, successors, etc.) have branch
(control flow) significance.
Fields
blocks: Vec<BasicBlock>Implementations
impl BasicCoverageBlock[src]
Trait Implementations
impl Clone for BasicCoverageBlock[src]
fn clone(&self) -> BasicCoverageBlock[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for BasicCoverageBlock[src]
Auto Trait Implementations
impl RefUnwindSafe for BasicCoverageBlock
impl Send for BasicCoverageBlock
impl Sync for BasicCoverageBlock
impl Unpin for BasicCoverageBlock
impl UnwindSafe for BasicCoverageBlock
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.