-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: Split off mappings.rs
from spans.rs
and from_mir.rs
#124545
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
In order to verify that the main patch consists only of moving two contiguous chunks of code (and adjusting imports), even after rebasing, I have manually verified it by doing the following:
(It's a shame that GitHub doesn't offer the option to show moved lines.) |
// FIXME(#124545) It's awkward that we have to re-export this, because it's an | ||
// internal detail of `from_mir` that is also needed when handling branch and | ||
// MC/DC spans. Ideally we would find a more natural home for it. | ||
pub(super) use from_mir::unexpand_into_body_span_with_visible_macro; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little unhappy with having to re-export this here, but I don't want this whole split to be held up on such a relatively minor detail, so for now I've just left a FIXME note.
@bors r+ |
extract_refined_covspans, unexpand_into_body_span_with_visible_macro, | ||
}; | ||
use crate::coverage::ExtractedHirInfo; | ||
use rustc_index::IndexVec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh whoops; I should clean up this misplaced import in one of my future PRs.
☀️ Test successful - checks-actions |
Finished benchmarking commit (a743116): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 672.522s -> 673.085s (0.08%) |
coverage: Split out MC/DC mappings from `BcbMappingKind` These variants were added to `BcbMappingKind` as part of the [MC/DC coverage](https://en.wikipedia.org/wiki/Modified_Condition/Decision_Coverage) implementation in rust-lang#123409, because that was the path-of-least-resistance for integrating them into the existing code. However, they ultimately represent complex concepts that the enum was not intended to handle, leading to more complexity in the code that processes them. This PR therefore follows in the footsteps of rust-lang#124545, and splits the MC/DC mappings out into their own dedicated vectors of structs. After that, `BcbMappingKind` itself ends up having only one variant (`Code`), so this PR also flattens that enum into its enclosing struct, renamed to `mapping::CodeMapping`. --- No functional changes. This will conflict slightly with rust-lang#124571, but hopefully that should be easy to resolve either way. `@rustbot` label +A-code-coverage
Originally,
spans.rs
was mainly concerned with extracting and post-processing spans from MIR, so that they could be used for block coverage instrumentation.Over time it has organically expanded to include more responsibilities, especially relating to branch coverage and MC/DC coverage, that don't really fit its current name.
This PR therefore takes all the extra code that is not part of the old span-refinement engine, and moves it out into a new
mappings.rs
file.No functional changes. I have deliberately avoided doing any follow-up (such as renaming types or functions), because this particular change is very rot-prone, and I want it to be as simple and self-contained as possible.
@rustbot label +A-code-coverage