Commit Graph

484 Commits

Author SHA1 Message Date
Jana Dönszelmann decec173ec remove AttributeKind everywhere 2026-02-20 09:50:16 +01:00
Jana Dönszelmann 63edc913fa change all uses 2026-02-20 09:50:16 +01:00
Zalathar 0418f9aa42 coverage: Add a test case for a previously-unknown span mismatch 2026-02-03 22:53:38 +11:00
Zalathar 986db13c17 coverage: Use the sorted expansion tree to determine min/max BCBs 2026-01-20 13:29:09 +11:00
Zalathar 7a3e5cd57e coverage: Sort the expansion tree in depth-first order
This makes it possible for subsequent operations to iterate over all nodes,
while assuming that every node occurs before all of its descendants.
2026-01-20 13:29:09 +11:00
Zalathar ac437169ec coverage: Store branch spans in the expansion tree 2025-11-30 18:31:55 +11:00
Zalathar 61c923b765 coverage: Store fn_sig_span and body_span in the expansion tree 2025-11-30 18:31:55 +11:00
Zalathar 696690ba21 coverage: Associate hole spans with expansion tree nodes
This will make it easier to perform span refinement for child expansions.
2025-11-11 14:35:52 +11:00
Zalathar 075f9c4984 coverage: Eagerly ensure that span refinement has an expansion tree node
This also replaces `push_covspan` with a separate covspan-filtering step,
because the relevant code is being reindented anyway.
2025-11-11 14:34:57 +11:00
Zalathar c78387192f coverage: Hoist expansion tree creation out of span refinement
This is an incremental step towards making the expansion tree central to
coverage mapping creation, which will be needed for proper expansion region
support.
2025-11-11 14:34:51 +11:00
Camille Gillot b7c2b3dc80 Remove StatementKind::Deinit. 2025-10-10 12:57:24 +00:00
Matthias Krüger 81042523c6 remove couple of clones 2025-09-05 15:38:01 +02:00
Zalathar c2eb45b4a1 coverage: Build an "expansion tree" and use it to unexpand raw spans 2025-08-24 20:29:34 +10:00
Camille Gillot 689171d38e Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures. 2025-08-22 02:22:51 +00:00
Zalathar ecce90b3ef coverage: Remove intermediate data structures from mapping creation 2025-08-14 21:35:23 +10:00
Zalathar db9f0bb532 coverage: Remove obsolete comment about hashing HIR
This code does not hash HIR manually (and has not done so for some time); it
merely obtains a hash returned as part of `hir_owner_nodes`.
2025-08-08 20:04:15 +10:00
Zalathar 7671b5af71 coverage: Extract HIR-related helper code out of the main module 2025-08-08 20:04:13 +10:00
Zalathar 81ed042c8c coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
Zalathar fb39d3ed88 coverage: Push async special case down into extract_refined_covspans 2025-08-04 13:48:41 +10:00
Zalathar 51e62a09a3 coverage: Remove -Zcoverage-options=no-mir-spans
This flag turned out to be less useful than anticipated, and interferes with
work towards expansion support.
2025-08-04 13:48:40 +10:00
Jana Dönszelmann e1d3ad89c7 remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
Zalathar 2e6f4a5922 coverage: Re-land "Enlarge empty spans during MIR instrumentation"
This allows us to assume that coverage spans will only be discarded during
codegen in very unusual situations.
2025-07-30 13:17:05 +10:00
Zalathar 682f744f89 coverage: Treat #[automatically_derived] as #[coverage(off)] 2025-07-29 19:56:31 +10:00
Zalathar b4d0c91635 coverage: Rename CoverageStatus to CoverageAttrKind
This patch also prepares the affected code in `coverage_attr_on` for some
subsequent changes.
2025-07-29 19:55:54 +10:00
Cameron Steffen b43164cef6 Rename impl_of_method -> impl_of_assoc 2025-07-28 09:54:53 -05:00
Zalathar 2b17897092 Revert "coverage: Enlarge empty spans during MIR instrumentation, not codegen"
This reverts commit f877aa7d14.
2025-07-26 11:14:40 +10:00
Zalathar f877aa7d14 coverage: Enlarge empty spans during MIR instrumentation, not codegen
This allows us to assume that coverage spans will only be discarded during
codegen in very unusual situations.
2025-07-22 19:49:54 +10:00
Sasha Pourcelot 4e054fc4c4 Port #[coverage] to the new attribute system 2025-07-16 15:51:18 +02:00
dianqk 24e553e6bc mir: Use the new method for BasicBlockData 2025-06-29 20:39:13 +08:00
dianqk 9f9cd5e283 mir: Add a new method to statement
Avoid introducing a large number of changes when adding optional initialization fields.
2025-06-29 20:13:36 +08:00
Zalathar 3f526eeec4 coverage: Revert "unused local file IDs" due to empty function names
This reverts commit 3b22c21dd8, reversing
changes made to 5f292eea6d.
2025-05-27 23:33:29 +10:00
Zalathar 339556eb02 coverage: Enlarge empty spans during MIR instrumentation, not codegen
This allows us to assume that coverage spans will only be discarded during
codegen in very unusual situations.
2025-05-10 00:24:01 +10:00
Zalathar 77a7ae4e9f coverage: Handle hole spans without dividing spans into buckets
Because we no longer merge non-adjacent spans, there is no need to use buckets
to prevent merging across hole spans.
2025-05-06 20:42:40 +10:00
Zalathar 4d5a1acebf coverage: Only merge adjacent coverage spans
This also removes some manipulation of the function signature span that only
made sense in the context of merging non-adjacent spans.
2025-05-06 20:42:25 +10:00
bors 43e62a789c Auto merge of #140288 - Zalathar:new-executor, r=jieyouxu
compiletest: Re-land using the new non-libtest executor by default

This PR re-lands #139998, which had the misfortune of triggering download-rustc in its CI jobs, so we didn't get proper test metrics for comparison with the old implementation. So that was PR was reverted in #140233, with the intention of re-landing it alongside a dummy compiler change to inhibit download-rustc.

---

Original PR description for #139998:
>The new executor was implemented in #139660, but required a manual opt-in. This PR activates the new executor by default, but leaves the old libtest-based executor in place (temporarily) to make reverting easier if something unexpectedly goes horribly wrong.
>
>Currently the new executor can be explicitly disabled by passing the `-N` flag to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be removed, alongside the removal of the libtest dependency. The flag is mostly there to make manual comparative testing easier if something does go wrong.
>
>As before, there *should* be no user-visible difference between the old executor and the new executor.

---
r? jieyouxu
2025-04-26 22:33:56 +00:00
Zalathar 1670de40e0 Trivial compiler change to inhibit download-rustc in CI 2025-04-25 20:41:50 +10:00
Zalathar f673c9b056 Trivial compiler change to inhibit download-rustc in CI 2025-04-24 19:44:13 +10:00
Zalathar 26cea8a286 coverage: Don't split bang-macro spans, just truncate them 2025-04-01 13:13:21 +11:00
Zalathar 62a533ce78 coverage: Instead of splitting, just discard any span that overlaps a hole 2025-04-01 13:13:20 +11:00
Zalathar 577272eede coverage: Shrink call spans to just the function name
This is a way to shrink call spans that doesn't involve mixing different spans,
and avoids overlap with argument spans.

This patch also removes some low-value comments that were causing rustfmt to
ignore the match arms.
2025-04-01 13:07:33 +11:00
Zalathar 7fdac5eef0 coverage: Defer the filtering of hole spans 2025-03-21 21:23:50 +11:00
Zalathar 83b56eb059 coverage: Separate span-extraction from unexpansion 2025-03-21 21:23:50 +11:00
Zalathar cc8336b6c1 coverage: Don't store a body span in FunctionCoverageInfo 2025-03-18 23:18:24 +11:00
bors 7d8c6e781d Auto merge of #135726 - jdonszelmann:attr-parsing, r=oli-obk
New attribute parsing infrastructure

Another step in the plan outlined in https://github.com/rust-lang/rust/issues/131229

introduces infrastructure for structured parsers for attributes, as well as converting a couple of complex attributes to have such structured parsers.

This PR may prove too large to review. I left some of my own comments to guide it a little. Some general notes:

- The first commit is basically standalone. It just preps some mostly unrelated sources for the rest of the PR to work. It might not have enormous merit on its own, but not negative merit either. Could be merged alone, but also doesn't make the review a whole lot easier. (but it's only +274 -209)
- The second commit is the one that introduces new infrastructure. It's the important one to review.
- The 3rd commit uses the new infrastructure showing how some of the more complex attributes can be parsed using it. Theoretically can be split up, though the parsers in this commit are the ones that really test the new infrastructure and show that it all works.
- The 4th commit fixes up rustdoc and clippy. In the previous 2 they didn't compile yet while the compiler does. Separated them out to separate concerns and make the rest more palatable.
- The 5th commit blesses some test outputs. Sometimes that's just because a diagnostic happens slightly earlier than before, which I'd say is acceptable. Sometimes a diagnostic is now only emitted once where it would've been twice before (yay! fixed some bugs). One test I actually moved from crashes to fixed, because it simply doesn't crash anymore. That's why this PR  Closes #132391. I think most choices I made here are generally reasonable, but let me know if you disagree anywhere.
- The 6th commit adds a derive to pretty print attributes
- The 7th removes smir apis for attributes, for the time being. The api will at some point be replaced by one based on `rustc_ast_data_structures::AttributeKind`

In general, a lot of the additions here are comments. I've found it very important to document new things in the 2nd commit well so other people can start using it.

Closes #132391
Closes #136717
2025-02-24 23:07:24 +00:00
Jana Dönszelmann 115b3b03b0 Change span field accesses to method calls 2025-02-24 14:22:31 +01:00
Jacob Pratt 6aa015ae9d Rollup merge of #136610 - Jarcho:range_idx, r=Noratrieb
Allow `IndexSlice` to be indexed by ranges.

This comes with some annoyances as the index type can no longer inferred from indexing expressions. The biggest offender for this is `IndexVec::from_fn_n(|idx| ..., n)` where the index type won't be inferred from the call site or any index expressions inside the closure.

My main use case for this is mapping a `Place` to `Range<Idx>` for value tracking where the range represents all the values the place contains.
2025-02-24 02:11:32 -05:00
Michael Goulet 12e3911d81 Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
Jason Newcomb 162fb713ac Allow SliceIndex to be indexed by ranges. 2025-02-21 16:10:31 -05:00
Zalathar d38f6880c0 coverage: Make HolesVisitor::visit_hole_span a regular method 2025-02-19 14:02:29 +11:00
Zalathar 51f704f0ff coverage: Get hole spans from nested items without fully visiting them
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.
2025-02-19 14:01:46 +11:00