Module rustc_mir_transform::coverage::spans

source Β·

Modules§

Structs§

Functions§

  • compare_spans πŸ”’
    Compares two spans in (lo ascending, hi descending) order.
  • Uses the holes to divide the given covspans into buckets, such that:
  • Similar to .drain(..), but stops just before it would remove an item not satisfying the predicate.
  • Macros that expand into branches (e.g. assert!, trace!) tend to generate multiple condition/consequent blocks that have the span of the whole macro invocation, which is unhelpful. Keeping only the first such span seems to give better mappings, so remove the others.
  • Takes one of the buckets of (sorted) spans extracted from MIR, and β€œrefines” those spans by removing spans that overlap in unwanted ways.
  • When a span corresponds to a macro invocation that is visible from the function body, split it into two parts. The first part covers just the macro name plus !, and the second part covers the rest of the macro invocation. This seems to give better results for code that uses macros.