coverage: Associate hole spans with expansion tree nodes #148812
Merged
bors merged 3 commits intorust-lang:mainfrom Nov 14, 2025
Merged
coverage: Associate hole spans with expansion tree nodes #148812bors merged 3 commits intorust-lang:mainfrom
bors merged 3 commits intorust-lang:mainfrom
Conversation
This is an incremental step towards making the expansion tree central to coverage mapping creation, which will be needed for proper expansion region support.
This also replaces `push_covspan` with a separate covspan-filtering step, because the relevant code is being reindented anyway.
This will make it easier to perform span refinement for child expansions.
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Collaborator
|
rustbot has assigned @JonathanBrouwer. Use |
Contributor
|
@bors r+ rollup Code looks correct to me. Just some feedback, would be nice if we could put some doc comments on |
Collaborator
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 13, 2025
…uwer coverage: Associate hole spans with expansion tree nodes This PR is another incremental step towards expansion region support in coverage instrumentation. When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption. Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node. There should be no change to compiler output.
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 13, 2025
…uwer coverage: Associate hole spans with expansion tree nodes This PR is another incremental step towards expansion region support in coverage instrumentation. When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption. Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node. There should be no change to compiler output.
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 13, 2025
…uwer coverage: Associate hole spans with expansion tree nodes This PR is another incremental step towards expansion region support in coverage instrumentation. When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption. Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node. There should be no change to compiler output.
bors
added a commit
that referenced
this pull request
Nov 14, 2025
Rollup of 14 pull requests Successful merges: - #146978 (Emit error when using path-segment keyword as cfg pred) - #148543 (Correctly link to associated trait items in reexports) - #148808 (Some resolve cleanups) - #148812 (coverage: Associate hole spans with expansion tree nodes ) - #148826 (CStr docs: Fix CStr vs &CStr confusion) - #148850 (Implement `Read::read_array`) - #148867 (Refactor `Box::take`) - #148870 (Remove unused LLVMModuleRef argument) - #148878 (error when ABI does not support guaranteed tail calls) - #148901 (Disable rustdoc-test-builder test partially for SGX target.) - #148902 (add missing s390x target feature to std detect test) - #148904 (waffle: stop watching codegen ssa) - #148906 (Expose fmt::Arguments::from_str as unstable.) - #148907 (add assembly test for infinite recursion with `become`) r? `@ghost` `@rustbot` modify labels: rollup
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 14, 2025
…uwer coverage: Associate hole spans with expansion tree nodes This PR is another incremental step towards expansion region support in coverage instrumentation. When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption. Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node. There should be no change to compiler output.
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Nov 14, 2025
…uwer coverage: Associate hole spans with expansion tree nodes This PR is another incremental step towards expansion region support in coverage instrumentation. When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption. Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node. There should be no change to compiler output.
bors
added a commit
that referenced
this pull request
Nov 14, 2025
Rollup of 15 pull requests Successful merges: - #148543 (Correctly link to associated trait items in reexports) - #148808 (Some resolve cleanups) - #148812 (coverage: Associate hole spans with expansion tree nodes ) - #148826 (CStr docs: Fix CStr vs &CStr confusion) - #148850 (Implement `Read::read_array`) - #148867 (Refactor `Box::take`) - #148870 (Remove unused LLVMModuleRef argument) - #148878 (error when ABI does not support guaranteed tail calls) - #148901 (Disable rustdoc-test-builder test partially for SGX target.) - #148902 (add missing s390x target feature to std detect test) - #148904 (waffle: stop watching codegen ssa) - #148906 (Expose fmt::Arguments::from_str as unstable.) - #148907 (add assembly test for infinite recursion with `become`) - #148928 (Move & adjust some `!`-adjacent tests) - #148929 (ignore `build-rust-analyzer` even if it's a symlink) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Nov 14, 2025
Rollup merge of #148812 - Zalathar:expansions, r=JonathanBrouwer coverage: Associate hole spans with expansion tree nodes This PR is another incremental step towards expansion region support in coverage instrumentation. When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption. Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node. There should be no change to compiler output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is another incremental step towards expansion region support in coverage instrumentation.
When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption.
Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node.
There should be no change to compiler output.