about summary refs log tree commit diff
path: root/tests/coverage
AgeCommit message (Collapse)AuthorLines
2025-09-01Auto merge of #143290 - azhogin:azhogin/link-pub-async-impls, r=oli-obkbors-7/+7
pub async fn impl is monomorphized when func itself is monomorphized Implentation coroutine (`func::{closure#0}`) is monomorphized, when func itself is monomorphized. Currently, when `pub async fn foo(..)` is exported from lib and used in several dependent crates, only 'header' function is monomorphized in the defining crate. 'header' function, returning coroutine object, is monomorphized, but the coroutine's poll function (which actually implements all the logic for the function) is not. In such situation, `func::{closure#0}` will be monomorphized in every dependency. This PR adds monomorphization for `func::{closure#0}` (coroutine poll function), when func itself is monomorphized. Simple test with one lib async function and ten dependent crates (executable) that use the function, shows 5-7% compilation time improvement (single-threaded).
2025-09-01pub async fn implementation coroutine (func::{closure#0}) is monomorphized, ↵Andrew Zhogin-7/+7
when func itself is monomorphized
2025-08-24coverage: Build an "expansion tree" and use it to unexpand raw spansZalathar-21/+27
2025-08-24coverage: Add a specific test for `#[rustfmt::skip]`Zalathar-0/+47
2025-08-06coverage: Remove all unstable support for MC/DC instrumentationZalathar-1826/+0
2025-08-04coverage: Remove `-Zcoverage-options=no-mir-spans`Zalathar-202/+0
This flag turned out to be less useful than anticipated, and interferes with work towards expansion support.
2025-07-30coverage: Re-land "Enlarge empty spans during MIR instrumentation"Zalathar-39/+9
This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations.
2025-07-29coverage: Treat `#[automatically_derived]` as `#[coverage(off)]`Zalathar-35/+25
2025-07-29coverage: Test how `#[automatically_derived]` affects instrumentationZalathar-0/+370
2025-07-29coverage: Regression test for "function name is empty" bugZalathar-0/+266
The bug was triggered by a particular usage of the `?` try operator in a proc-macro expansion. Thanks to lqd for the minimization. Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
2025-07-26Revert "coverage: Enlarge empty spans during MIR instrumentation, not codegen"Zalathar-9/+12
This reverts commit f877aa7d14916f71a2f88c6d4c009e7ded7684c4.
2025-07-22coverage: Enlarge empty spans during MIR instrumentation, not codegenZalathar-12/+9
This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations.
2025-06-30Remove let_chains featureCameron Steffen-4/+4
2025-05-27coverage: Revert "unused local file IDs" due to empty function namesZalathar-38/+12
This reverts commit 3b22c21dd8c30f499051fe7a758ca0e5d81eb638, reversing changes made to 5f292eea6d63abbd26f1e6e00a0b8cf21d828d7d.
2025-05-10coverage: Detect unused local file IDs to avoid an LLVM assertionZalathar-0/+29
This case can't actually happen yet (other than via a testing flag), because currently all of a function's spans must belong to the same file and expansion. But this will be an important edge case when adding expansion region support.
2025-05-10coverage: Enlarge empty spans during MIR instrumentation, not codegenZalathar-12/+9
This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations.
2025-05-06coverage: Only merge adjacent coverage spansZalathar-1756/+2814
This also removes some manipulation of the function signature span that only made sense in the context of merging non-adjacent spans.
2025-05-06coverage-dump: Dump filenames instead of global file IDs (and bless)Zalathar-306/+306
2025-04-05Update the minimum external LLVM to 19Josh Stone-50/+40
2025-04-02Bless testsdianqk-104/+77
2025-04-02Revert "comment out the old tests instead of adjusting them"dianqk-10/+8
This reverts commit 906f66fb4c22daa8a6f97e5c048e9f6ab3fd9051.
2025-04-01coverage: Don't split bang-macro spans, just truncate themZalathar-128/+128
2025-04-01coverage: Instead of splitting, just discard any span that overlaps a holeZalathar-42/+46
2025-04-01coverage: Shrink call spans to just the function nameZalathar-90/+94
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-01coverage: Tweak tests/coverage/assert-ne.rsZalathar-2/+2
This test is intended to demonstrate that a particular macro-argument span doesn't get lost during span-refinement, but it turns out that span-extraction currently doesn't yield any MIR spans for this position. This patch therefore tweaks the test to add a function call in that position, so that it still remains relevant to span refinement.
2025-03-30Encode synthetic by-move coroutine body with a different DefPathDataMichael Goulet-7/+7
2025-02-19coverage: Add some more cases to `tests/coverage/holes.rs`Zalathar-17/+88
2025-02-13coverage: Eliminate more counters by giving them to unreachable nodesZalathar-218/+221
When preparing a function's coverage counters and metadata during codegen, any part of the original coverage graph that was removed by MIR optimizations can be treated as having an execution count of zero. Somewhat counter-intuitively, if we give those unreachable nodes a _higher_ priority for receiving physical counters (instead of counter expressions), that ends up reducing the total number of physical counters needed. This works because if a node is unreachable, we don't actually create a physical counter for it. Instead that node gets a fixed zero counter, and any other node that would have relied on that physical counter in its counter expression can just ignore that term completely.
2025-02-06coverage: Don't create counters for code that was removed by MIR optsZalathar-121/+84
2025-01-16coverage: Completely overhaul counter assignment, using node-flow graphsZalathar-1330/+1186
2025-01-09add comment to testlcnr-4/+6
2025-01-09Account for identity substituted items in symbol manglingMichael Goulet-0/+51
2024-12-24Add a test for coverage attr on trait functionEric Huss-0/+60
2024-12-23Revert "Auto merge of #130766 - clarfonthey:stable-coverage-attribute, ↵Zalathar-272/+335
r=wesleywiser" This reverts commit 1d35638dc38dbfbf1cc2a9823135dfcf3c650169, reversing changes made to f23a80a4c2fbca593b64e70f5970368824b4c5e9.
2024-12-19Rollup merge of #134497 - Zalathar:spans, r=jieyouxuMatthias Krüger-0/+37
coverage: Store coverage source regions as `Span` until codegen (take 2) This is an attempt to re-land #133418: > Historically, coverage spans were converted into line/column coordinates during the MIR instrumentation pass. > This PR moves that conversion step into codegen, so that coverage spans spend most of their time stored as Span instead. > In addition to being conceptually nicer, this also reduces the size of coverage mappings in MIR, because Span is smaller than 4x u32. That PR was reverted by #133608, because in some circumstances not covered by our test suite we were emitting coverage metadata that was causing `llvm-cov` to exit with an error (#133606). --- The implementation here is *mostly* the same, but adapted for subsequent changes in the relevant code (e.g. #134163). I believe that the changes in #134163 should be sufficient to prevent the problem that required the original PR to be reverted. But I haven't been able to reproduce the original breakage in a regression test, and the `llvm-cov` error message is extremely unhelpful, so I can't completely rule out the possibility of this breaking again. r? jieyouxu (reviewer of the original PR)
2024-12-19coverage: Add a synthetic test for when all spans are discardedZalathar-0/+37
2024-12-18Add reference annotations for the `coverage` attributeEric Huss-36/+48
2024-12-17Rollup merge of #134323 - Zalathar:dismantle-map-data, r=jieyouxuMatthias Krüger-4/+4
coverage: Dismantle `map_data.rs` by moving its responsibilities elsewhere This is a series of incremental changes that combine to let us get rid of `coverageinfo/map_data.rs`, by moving all of its responsibilities into more appropriate places. Some of the notable consequences are: - We once again build the per-CGU file table on the fly while preparing individual covfun records, instead of building the whole table up-front. The up-front approach was introduced by #117042 to work around various other problems in generating the covmap/covfun records, but subsequent cleanups have made that approach no longer necessary. - Expression conversion and mapping-region conversion are now performed directly in `mapgen::covfun`, which should make future changes easier. - We no longer insert unused function instances into the same map that is also used to track used function instances. This helps to decouple the handling of used vs unused functions. --- There should be no meaningful change to compiler output. The file table is no longer sorted, because reordering it would invalidate the file indices stored in individual covfun records, but the table order should still be deterministic (albeit arbitrary). There are some subsequent cleanups that I intend to investigate, but this is enough change for one PR.
2024-12-17coverage: Build the global file table on the flyZalathar-4/+4
2024-12-16Stabilize #[coverage] attributeltdk-341/+276
2024-12-13Stabilize async closuresMichael Goulet-14/+12
2024-12-07coverage: Prefer to visit nodes whose predecessors have been visitedZalathar-1076/+783
2024-12-05Stabilize noop_wakerEric Holk-89/+79
Co-authored-by: zachs18 <8355914+zachs18@users.noreply.github.com>
2024-12-04coverage: Add an extra "transcribe" step after counter creationZalathar-1428/+1433
2024-12-04coverage: Extract `subtracted_sum` in counter creationZalathar-4/+6
2024-12-02Gate async fn trait bound modifier on async_trait_boundsMichael Goulet-6/+6
2024-11-30coverage: Use a query to identify which counter/expression IDs are usedZalathar-8/+8
2024-11-27Auto merge of #133474 - RalfJung:gvn-miscompile, r=compiler-errorsbors-103/+120
Do not unify dereferences of shared borrows in GVN Repost of https://github.com/rust-lang/rust/pull/132461, the last commit applies my suggestions. Fixes https://github.com/rust-lang/rust/issues/130853
2024-11-25comment out the old tests instead of adjusting themRalf Jung-103/+120
2024-11-24Coverage test for allowing coverage in a `#![no_core]` crateZalathar-0/+34