Struct rustc_mir_transform::coverage::debug::UsedExpressions
source · pub(super) struct UsedExpressions {
some_used_expression_operands: Option<FxHashMap<ExpressionOperandId, Vec<InjectedExpressionId>>>,
some_unused_expressions: Option<Vec<(CoverageKind, Option<BasicCoverageBlock>, BasicCoverageBlock)>>,
}
Expand description
If enabled, this struct captures additional data used to track whether expressions were used,
directly or indirectly, to compute the coverage counts for all CoverageSpan
s, and any that are
not used are retained in the unused_expressions
Vec, to be included in debug output (logs
and/or a CoverageGraph
graphviz output).
Fields
some_used_expression_operands: Option<FxHashMap<ExpressionOperandId, Vec<InjectedExpressionId>>>
some_unused_expressions: Option<Vec<(CoverageKind, Option<BasicCoverageBlock>, BasicCoverageBlock)>>
Implementations
sourceimpl UsedExpressions
impl UsedExpressions
pub fn new() -> Self
pub fn enable(&mut self)
pub fn is_enabled(&self) -> bool
pub fn add_expression_operands(&mut self, expression: &CoverageKind)
pub fn expression_is_used(&self, expression: &CoverageKind) -> bool
pub fn add_unused_expression_if_not_found(
&mut self,
expression: &CoverageKind,
edge_from_bcb: Option<BasicCoverageBlock>,
target_bcb: BasicCoverageBlock
)
sourcepub fn get_unused_expressions(
&self
) -> Vec<(CoverageKind, Option<BasicCoverageBlock>, BasicCoverageBlock)>
pub fn get_unused_expressions(
&self
) -> Vec<(CoverageKind, Option<BasicCoverageBlock>, BasicCoverageBlock)>
Return the list of unused counters (if any) as a tuple with the counter (CoverageKind
),
optional from_bcb
(if it was an edge counter), and target_bcb
.
sourcepub fn validate(
&mut self,
bcb_counters_without_direct_coverage_spans: &[(Option<BasicCoverageBlock>, BasicCoverageBlock, CoverageKind)]
)
pub fn validate(
&mut self,
bcb_counters_without_direct_coverage_spans: &[(Option<BasicCoverageBlock>, BasicCoverageBlock, CoverageKind)]
)
If enabled, validate that every BCB or edge counter not directly associated with a coverage span is at least indirectly associated (it is a dependency of a BCB counter that is associated with a coverage span).
pub fn alert_on_unused_expressions(&self, debug_counters: &DebugCounters)
Auto Trait Implementations
impl RefUnwindSafe for UsedExpressions
impl Send for UsedExpressions
impl Sync for UsedExpressions
impl Unpin for UsedExpressions
impl UnwindSafe for UsedExpressions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut 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: 56 bytes