-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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: Get hole spans from nested items without fully visiting them #137251
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
This PR came out of the realization that I now have a somewhat better understanding of HIR visitors than I did when I wrote the original code. |
Ah, it turns out that we do need |
@rustbot author |
It turns out that this visitor doesn't actually need `nested_filter::All` to handle nested items; it just needs to override `visit_nested_item` and look up the item's span.
1310269
to
d38f688
Compare
Sadly this means we still have to use @rustbot ready |
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.
Thanks
@bors r+ |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#127793 (Added project-specific Zed IDE settings) - rust-lang#134995 (Stabilize const_slice_flatten) - rust-lang#136301 (Improve instant docs) - rust-lang#136347 (Add a bullet point to `std::fs::copy`) - rust-lang#136794 (Stabilize file_lock) - rust-lang#137094 (x86_win64 ABI: do not use xmm0 with softfloat ABI) - rust-lang#137227 (docs(dev): Update the feature-gate instructions) - rust-lang#137232 (Don't mention `FromResidual` on bad `?`) - rust-lang#137251 (coverage: Get hole spans from nested items without fully visiting them) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137251 - Zalathar:holes-visitor, r=jieyouxu coverage: Get hole spans from nested items without fully visiting them This is a small simplification to the code that collects the spans of nested items within a function, so that those spans can be treated as “holes” to be avoided by the current function's coverage mappings. The old code was using `nested_filter::All` to ensure that the visitor would see nested items. But we don't need the actual items themselves; we just need their spans, which we can obtain via a custom implementation of `visit_nested_item`. This avoids the more expansive queries required by `nested_filter::All`.
This is a small simplification to the code that collects the spans of nested items within a function, so that those spans can be treated as “holes” to be avoided by the current function's coverage mappings.
The old code was using
nested_filter::All
to ensure that the visitor would see nested items. But we don't need the actual items themselves; we just need their spans, which we can obtain via a custom implementation ofvisit_nested_item
.This avoids the more expansive queries required by
nested_filter::All
.