1
Fork 0

coverage: Discard spans that fill the entire function body

When we try to extract coverage-relevant spans from MIR, sometimes we see MIR
statements/terminators whose spans cover the entire function body. Those spans
tend to be unhelpful for coverage purposes, because they often represent
compiler-inserted code, e.g. the implicit return value of `()`.
This commit is contained in:
Zalathar 2024-02-15 18:12:27 +11:00
parent 75af3c58f9
commit cd9021e8cb
10 changed files with 29 additions and 33 deletions

View file

@ -14,13 +14,13 @@
LL| |#[coverage(on)]
LL| 1|fn contains_closures_on() {
LL| 1| let _local_closure_on = #[coverage(on)]
LL| 1| |input: &str| {
LL| 0| |input: &str| {
LL| 0| println!("{input}");
LL| 1| };
LL| 0| };
LL| 1| let _local_closure_off = #[coverage(off)]
LL| 1| |input: &str| {
LL| | |input: &str| {
LL| | println!("{input}");
LL| 1| };
LL| | };
LL| 1|}
LL| |
LL| |#[coverage(off)]