[−][src]Struct rustc_mir::transform::instrument_coverage::CoverageSpanRefinery

struct CoverageSpanRefinery<'a> {
    sorted_spans_iter: IntoIter<CoverageSpan>,
    dominators: &'a Dominators<BasicBlock>,
    some_curr: Option<CoverageSpan>,
    curr_original_span: Span,
    some_prev: Option<CoverageSpan>,
    prev_original_span: Span,
    pending_dups: Vec<CoverageSpan>,
    refined_spans: Vec<CoverageSpan>,
}

Fields

sorted_spans_iter: IntoIter<CoverageSpan>dominators: &'a Dominators<BasicBlock>some_curr: Option<CoverageSpan>curr_original_span: Spansome_prev: Option<CoverageSpan>prev_original_span: Spanpending_dups: Vec<CoverageSpan>refined_spans: Vec<CoverageSpan>

Implementations

impl<'a> CoverageSpanRefinery<'a>[src]

fn from_sorted_spans(
    sorted_spans: Vec<CoverageSpan>,
    dominators: &'a Dominators<BasicBlock>
) -> Self
[src]

fn to_refined_spans(self) -> Vec<CoverageSpan>[src]

Iterate through the sorted CoverageSpans, and return the refined list of merged and de-duplicated CoverageSpans.

fn add_refined_span(&mut self, coverage_span: CoverageSpan)[src]

fn to_refined_spans_without_closures(self) -> Vec<CoverageSpan>[src]

Remove CoverageSpans derived from closures, originally added to ensure the coverage regions for the current function leave room for the closure's own coverage regions (injected separately, from the closure's own MIR).

fn curr(&self) -> &CoverageSpan[src]

fn curr_mut(&mut self) -> &mut CoverageSpan[src]

fn prev(&self) -> &CoverageSpan[src]

fn prev_mut(&mut self) -> &mut CoverageSpan[src]

fn take_prev(&mut self) -> CoverageSpan[src]

fn check_pending_dups(&mut self)[src]

If there are pending_dups but prev is not a matching dup (prev.span doesn't match the pending_dups spans), then one of the following two things happened during the previous iteration:

  • the span of prev was modified (by curr_mut().merge_from(prev)); or
  • the span of prev advanced past the end of the span of pending_dups (prev().span.hi() <= curr().span.lo()) In either case, no more spans will match the span of pending_dups, so add the pending_dups if they don't overlap curr, and clear the list.

fn next_coverage_span(&mut self) -> bool[src]

Advance prev to curr (if any), and curr to the next CoverageSpan in sorted order.

fn discard_curr(&mut self)[src]

If called, then the next call to next_coverage_span() will not update prev with the curr coverage span.

fn prev_starts_after_next(&self, next_curr: &CoverageSpan) -> bool[src]

Returns true if the curr span should be skipped because prev has already advanced beyond the end of curr. This can only happen if a prior iteration updated prev to skip past a region of code, such as skipping past a closure.

fn prev_ends_before_curr(&self) -> bool[src]

Returns true if the curr span starts past the end of the prev span, which means they don't overlap, so we now know the prev can be added to the refined coverage spans.

fn carve_out_span_for_closure(&mut self)[src]

If prevs span extends left of the closure (curr), carve out the closure's span from prev's span. (The closure's coverage counters will be injected when processing the closure's own MIR.) Add the portion of the span to the left of the closure; and if the span extends to the right of the closure, update prev to that portion of the span. For any pending_dups, repeat the same process.

fn hold_pending_dups_unless_dominated(&mut self)[src]

When two CoverageSpans have the same Span, dominated spans can be discarded; but if neither CoverageSpan dominates the other, both (or possibly more than two) are held, until their disposition is determined. In this latter case, the prev dup is moved into pending_dups so the new curr dup can be moved to prev for the next iteration.

fn cutoff_prev_at_overlapping_curr(&mut self)[src]

curr overlaps prev. If prevs span extends left of currs span, keep only statements that end before curr.lo() (if any), and add the portion of the combined span for those statements. Any other statements have overlapping spans that can be ignored because curr and/or other upcoming statements/spans inside the overlap area will produce their own counters. This disambiguation process avoids injecting multiple counters for overlapping spans, and the potential for double-counting.

Auto Trait Implementations

impl<'a> RefUnwindSafe for CoverageSpanRefinery<'a>

impl<'a> !Send for CoverageSpanRefinery<'a>

impl<'a> !Sync for CoverageSpanRefinery<'a>

impl<'a> Unpin for CoverageSpanRefinery<'a>

impl<'a> UnwindSafe for CoverageSpanRefinery<'a>

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]