Commit Graph

5 Commits

Author SHA1 Message Date
Zalathar
f521dd4ed9 Switch over to hybrid HIR-aware coverage spans
Instead of trying to heuristically recover source-code spans from MIR soup, we
can now take advantage of the `CoverageKind::Point` statements injected for
specific HIR expressions.

This is a transitional implementation that lets us remove the old MIR-soup
code, but still relies heavily on the existing span-refinement heuristics, and
does not take advantage of the full possibilities of HIR-aware coverage
instrumentation.

In order to avoid annoying never-executed spans in code that contains
assertions, a heuristic has been added that ignores any expression within the
arguments of a macro-expanded function call that returns `!`.

Some coverage tests now require `//@ min-llvm-version: 23`, due to changes in
how LLVM sorts the coverage mapping entries.
2026-09-06 10:24:48 +10:00
Zalathar
492fff70b8 Add some simple coverage tests for common constructs 2026-09-04 16:20:03 +10:00
Zalathar
c7c0eeaa3a Move some less-useful tests into tests/coverage/iffy
These tests are of limited value for investigating specific problems, but still
have some worth in detecting regressions by adding variety to the test corpus.

(The boundary is a bit fuzzy, but it's easy enough to move tests back out if
appropriate.)
2026-09-04 16:20:03 +10:00
Zalathar
1f9353ae2c coverage: Tweak individual tests to be unaffected by rustfmt
Some of these tests use non-standard formatting that we can simulate by
strategically adding `//` line comments.

One contains `where` clauses that would be split across multiple lines, which
we can keep on one line by moving the bounds to the generic type instead.
2024-01-16 16:14:27 +11:00
Zalathar
e9d04c5e24 coverage: Migrate tests/run-coverage into tests/coverage 2023-11-07 11:15:19 +11:00