Skip to content
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

Update some outdated descriptions of coverage instrumentation #1809

Merged
merged 1 commit into from
Nov 4, 2023

Conversation

Zalathar
Copy link
Contributor

Coverage internals have changed quite a bit over recent months/weeks, so I decided to at least make a pass over the existing docs and update anything that is clearly outdated.

@JohnTitor
Copy link
Member

I'm not familiar with that, could you point to a relevant PR (or ping a better reviewer)?

@Zalathar
Copy link
Contributor Author

This is mainly based on my own recent work in rust-lang/rust#116046.

It used to be that mappings between coverage counters and source code regions were stored directly in special coverage statements that the coverage instrumentor would inject into MIR.

After that change, those mappings are now stored in a FunctionCoverageInfo struct that is attached to the function's mir::Body.


The part about injecting counters into MIR has been obsoleted by follow-up work in rust-lang/rust#116917.

What used to be a fairly intricate region of code for injecting various things into MIR has been replaced by two fairly simple loops.

@Zalathar
Copy link
Contributor Author

cc @Swatinem in case you want to look over this as well.

Comment on lines -330 to -332
(with no internal branching), plus a `CoverageKind` counter (to
be added, via coverage analysis), and an optional set of additional counters
to count incoming edges (if there are more than one).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The extra fields mentioned here were moved out into side-tables in CoverageCounters in rust-lang/rust#114354.

Comment on lines -346 to -350
statements. This is done by three distinct functions:
- `inject_coverage_span_counters()`
- `inject_indirect_counters()`
- `inject_intermediate_expression()`, called for each intermediate expression
returned from `make_bcb_counters()`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The three inject function mentioned here were removed by rust-lang/rust#116917, and replaced with a much simpler pair of loops in create_mappings_and_inject_coverage_statements.

@davidtwco davidtwco merged commit f42a31f into rust-lang:master Nov 4, 2023
1 check passed
@Zalathar Zalathar deleted the coverage branch November 5, 2023 01:39
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 7, 2023
Update books

## rust-lang/reference

4 commits in 16fd3c06d9e558dae2d52000818274ae70c9e90a..cd8193e972f61b92117095fc73b67af767b4d6bc
2023-11-04 17:19:39 UTC to 2023-10-30 16:04:52 UTC

- Guarantee that raw pointer conversions preserve slice element count (rust-lang/reference#1417)
- some asm block flags also mean there can be no fences (rust-lang/reference#1413)
- Guarantee `char` layout (rust-lang/reference#1401)
- Doc: Add the RISC-V stabilized target features (rust-lang/reference#1415)

## rust-lang/rust-by-example

3 commits in 6709beeb7d0fbc5ffc91ac4893a24434123b9bfa..311b84962016b28c75525c86e7b3f49fd9101a39
2023-10-31 18:32:09 UTC to 2023-10-31 18:30:39 UTC

- Fixed explanation mistake in comment (rust-lang/rust-by-example#1761)
- Fix typos (rust-lang/rust-by-example#1759)
- docs(9.2): fix typo (rust-lang/rust-by-example#1754)

## rust-lang/rustc-dev-guide

6 commits in b0ee9ec..77dbe57
2023-11-06 16:14:34 UTC to 2023-10-29 17:16:02 UTC

- add a new type system invariant (rust-lang/rustc-dev-guide#1822)
- Update some outdated descriptions of coverage instrumentation (rust-lang/rustc-dev-guide#1809)
- Add some documentation for unsizing (rust-lang/rustc-dev-guide#1817)
- Bibliography: fixing author of "You Can't Spell Trust Without Rust" (rust-lang/rustc-dev-guide#1815)
- remove change-id from sample build configuration (rust-lang/rustc-dev-guide#1813)
- Update name of "active" features to "unstable" (rust-lang/rustc-dev-guide#1814)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 7, 2023
Rollup merge of rust-lang#117639 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/reference

4 commits in 16fd3c06d9e558dae2d52000818274ae70c9e90a..cd8193e972f61b92117095fc73b67af767b4d6bc
2023-11-04 17:19:39 UTC to 2023-10-30 16:04:52 UTC

- Guarantee that raw pointer conversions preserve slice element count (rust-lang/reference#1417)
- some asm block flags also mean there can be no fences (rust-lang/reference#1413)
- Guarantee `char` layout (rust-lang/reference#1401)
- Doc: Add the RISC-V stabilized target features (rust-lang/reference#1415)

## rust-lang/rust-by-example

3 commits in 6709beeb7d0fbc5ffc91ac4893a24434123b9bfa..311b84962016b28c75525c86e7b3f49fd9101a39
2023-10-31 18:32:09 UTC to 2023-10-31 18:30:39 UTC

- Fixed explanation mistake in comment (rust-lang/rust-by-example#1761)
- Fix typos (rust-lang/rust-by-example#1759)
- docs(9.2): fix typo (rust-lang/rust-by-example#1754)

## rust-lang/rustc-dev-guide

6 commits in b0ee9ec..77dbe57
2023-11-06 16:14:34 UTC to 2023-10-29 17:16:02 UTC

- add a new type system invariant (rust-lang/rustc-dev-guide#1822)
- Update some outdated descriptions of coverage instrumentation (rust-lang/rustc-dev-guide#1809)
- Add some documentation for unsizing (rust-lang/rustc-dev-guide#1817)
- Bibliography: fixing author of "You Can't Spell Trust Without Rust" (rust-lang/rustc-dev-guide#1815)
- remove change-id from sample build configuration (rust-lang/rustc-dev-guide#1813)
- Update name of "active" features to "unstable" (rust-lang/rustc-dev-guide#1814)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants