Skip to content

coverage: Rename the three main coverage-info structs - #161902

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Zalathar:coverage-info
Aug 30, 2026
Merged

coverage: Rename the three main coverage-info structs#161902
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Zalathar:coverage-info

Conversation

@Zalathar

@Zalathar Zalathar commented Aug 28, 2026

Copy link
Copy Markdown
Member

This PR renames the three main structures used to carry per-function coverage info through different stages of compilation:

- CoverageInfoHi       => CoverageEarlyInfo   // collected early, at the THIR/MIR boundary during MIR building
- FunctionCoverageInfo => CoverageMirInfo     // collected during the main MIR instrumentation pass
- CoverageIdsInfo      => CoverageCodegenInfo // collected during codegen, after MIR opts

The new names should hopefully help to keep the three structs distinct, while also avoiding the historical inconsistency of the previous names.

The renaming also resolves an old TODO of mine about coverage_ids_info no longer making sense as a name.

There should be no change to compiler behaviour.

@rustbot

rustbot commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @vakaras

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 28, 2026
@rustbot

rustbot commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, mir
  • compiler, mir expanded to 75 candidates
  • Random selection from 18 candidates

@Zalathar Zalathar added the A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) label Aug 28, 2026
@rustbot

This comment has been minimized.

@mejrs

mejrs commented Aug 29, 2026

Copy link
Copy Markdown
Member

I'm not a fan of putting "early" in names of things. In my experience it tends to be somewhat vague and it ages poorly. How about CoverageHirInfo?

@rustbot

rustbot commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

- CoverageInfoHi       => CoverageEarlyInfo
- FunctionCoverageInfo => CoverageMirInfo
- CoverageIdsInfo      => CoverageCodegenInfo
@Zalathar

Copy link
Copy Markdown
Member Author

I'm not a fan of putting "early" in names of things. In my experience it tends to be somewhat vague and it ages poorly. How about CoverageHirInfo?

Hmm, I see the general concern, but in this instance I think it's doing good work, and there's less risk of it going stale than if we tried to use a less-vague name.

The main distinction I'm trying to make is that of the two side-data structs attached to a MIR body, this is the one that has to be prepared at a time before the main InstrumentCoverage pass, because it preserves information that is only available during MIR building.

The struct itself contains whatever currently needs to be collected early and stored as side-data. It's less “important” than the side-data recorded during instrumentation, and ceases to have value after instrumentation. Any my hope is that follow-up work to #161517 will allow it to be removed entirely.


The specific suggestion of CoverageHirInfo doesn't work, partly because it clashes with ExtractedHirInfo which is extracted later (during instrumentation), and partly because the “HIR” part would be more misleading than accurate.

I could imagine it being named something verbose like CoverageEarlyMirBuildInfo, but going down that road seems to just make things clunkier without making them clearer. The actual role of the struct can't be fully captured in its name, so I'd prefer a distinctive name that presents the key distinction (early collection) and otherwise gets out of the way.

@mejrs mejrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@bors r+ rollup

View changes since this review

@rust-bors

rust-bors Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0bce041 has been approved by mejrs

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 30, 2026
coverage: Rename the three main coverage-info structs

This PR renames the three main structures used to carry per-function coverage info through different stages of compilation:
```text
- CoverageInfoHi       => CoverageEarlyInfo   // collected early, at the THIR/MIR boundary during MIR building
- FunctionCoverageInfo => CoverageMirInfo     // collected during the main MIR instrumentation pass
- CoverageIdsInfo      => CoverageCodegenInfo // collected during codegen, after MIR opts
```

The new names should hopefully help to keep the three structs distinct, while also avoiding the historical inconsistency of the previous names.

The renaming also resolves an old TODO of mine about `coverage_ids_info` no longer making sense as a name.

There should be no change to compiler behaviour.
rust-bors Bot pushed a commit that referenced this pull request Aug 30, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #162004 (Remove unneeded clone in macro deriving)
 - #161902 (coverage: Rename the three main coverage-info structs)
 - #161967 (Rerun `tests/debuginfo` tests if repr data has changed)
 - #161977 (update target-cpus test)
@rust-bors
rust-bors Bot merged commit cabecc6 into rust-lang:main Aug 30, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 30, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 30, 2026
Rollup merge of #161902 - Zalathar:coverage-info, r=mejrs

coverage: Rename the three main coverage-info structs

This PR renames the three main structures used to carry per-function coverage info through different stages of compilation:
```text
- CoverageInfoHi       => CoverageEarlyInfo   // collected early, at the THIR/MIR boundary during MIR building
- FunctionCoverageInfo => CoverageMirInfo     // collected during the main MIR instrumentation pass
- CoverageIdsInfo      => CoverageCodegenInfo // collected during codegen, after MIR opts
```

The new names should hopefully help to keep the three structs distinct, while also avoiding the historical inconsistency of the previous names.

The renaming also resolves an old TODO of mine about `coverage_ids_info` no longer making sense as a name.

There should be no change to compiler behaviour.
@Zalathar
Zalathar deleted the coverage-info branch August 30, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants