-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
coverage: Remove the final span-merge pass, and rename is_closure
to is_hole
#121433
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
The final merge pass was introduced in #118695, replacing the previous practice of performing a merge on every entry added to the list of refined covspans. |
This step used to be essential, but after other recent changes to span refinement it doesn't appear to be particularly necessary. Removing the final merge step will make it easier to simplify or replace the span refinement code.
Now that we don't perform a final merge pass on refined spans, there's no need to create refined spans for closure/hole spans, so we can just discard them immediately.
When refining covspans, we don't specifically care which ones represent closures; we just want to know which ones represent "holes" that should be carved out of other spans and then discarded. (Closures are currently the only source of hole spans, but in the future we might want to also create hole spans for nested items and inactive `#[cfg(..)]` regions.)
Hmm, thinking about this some more, whatever I replace the span refiner with might want to only have a post-merging step. Perhaps I should experiment with that a bit more before advancing down this particular path. |
@rustbot author |
Since I'm having second thoughts about moving the final span-merge pass, I'll extract the other changes into a new PR. |
coverage: Rename `is_closure` to `is_hole` Extracted from rust-lang#121433, since I was having second thoughts about some of the other changes bundled in that PR, but these changes are still fine. --- When refining covspans, we don't specifically care which ones represent closures; we just want to know which ones represent "holes" that should be carved out of other spans and then discarded. (Closures are currently the only source of hole spans, but in the future we might want to also create hole spans for nested items and inactive `#[cfg(..)]` regions.) `@rustbot` label +A-code-coverage
coverage: Rename `is_closure` to `is_hole` Extracted from rust-lang#121433, since I was having second thoughts about some of the other changes bundled in that PR, but these changes are still fine. --- When refining covspans, we don't specifically care which ones represent closures; we just want to know which ones represent "holes" that should be carved out of other spans and then discarded. (Closures are currently the only source of hole spans, but in the future we might want to also create hole spans for nested items and inactive `#[cfg(..)]` regions.) ``@rustbot`` label +A-code-coverage
Rollup merge of rust-lang#121492 - Zalathar:hole, r=fmease coverage: Rename `is_closure` to `is_hole` Extracted from rust-lang#121433, since I was having second thoughts about some of the other changes bundled in that PR, but these changes are still fine. --- When refining covspans, we don't specifically care which ones represent closures; we just want to know which ones represent "holes" that should be carved out of other spans and then discarded. (Closures are currently the only source of hole spans, but in the future we might want to also create hole spans for nested items and inactive `#[cfg(..)]` regions.) ``@rustbot`` label +A-code-coverage
This is a combination of semi-related changes that all touch the coverage span-refinement code.
The first significant change is to remove the final span-merging pass that occurs after the main span-refinement code has run. This step used to be essential for getting good coverage mappings, but after other recent changes to span refinement (e.g. #121135 and #121261) it doesn't seem to have much effect any more, so we can simplify the code by removing it.
The other big change is to take code that refers to “closure spans”, and rename it to refer to “hole spans” instead. When checking for the
is_closure
flag, we don't specifically care whether the span represents a closure; we just want to know whether it's a span that should be carved out of other spans and then discarded.(Closure spans are currently the only kind of hole span, but in the future might want to add other kinds of hole spans representing nested items or inactive
#[cfg(..)]
regions.)@rustbot label +A-code-coverage