rust/tests
bors cc705b8012 Auto merge of #116046 - Zalathar:fn-cov-info, r=cjgillot
coverage: Move most per-function coverage info into `mir::Body`

Currently, all of the coverage information collected by the `InstrumentCoverage` pass is smuggled through MIR in the form of individual `StatementKind::Coverage` statements, which must then be reassembled by coverage codegen.

That's awkward for a number of reasons:
- While some of the coverage statements do care about their specific position in the MIR control-flow graph, many of them don't, and are just tacked onto the function's first BB as metadata carriers.
- MIR inlining can result in coverage statements being duplicated, so coverage codegen has to jump through hoops to avoid emitting duplicate mappings.
- MIR optimizations that would delete coverage statements need to carefully copy them into the function's first BB so as not to omit them from coverage reports.
- The order in which coverage codegen sees coverage statements is dependent on MIR optimizations/inlining, which can cause unnecessary churn in the emitted coverage mappings.
- We don't have a good way to annotate MIR-level functions with extra coverage info that doesn't belong in a statement.

---

This PR therefore takes most of the per-function coverage info and stores it in a field in `mir::Body` as `Option<Box<FunctionCoverageInfo>>`.

(This adds one pointer to the size of `mir::Body`, even when coverage is not enabled.)

Coverage statements still need to be injected into MIR in some cases, but only when they actually affect codegen (counters) or are needed to detect code that has been optimized away as unreachable (counters/expressions).

---

By the end of this PR, the information stored in `FunctionCoverageInfo` is:

- A hash of the function's source code (needed by LLVM's coverage map format)
- The number of coverage counters added by coverage instrumentation
- A table of coverage expressions, associating each expression ID with its operator (add or subtract) and its two operands
- The list of mappings, associating each covered code region with a counter/expression/zero value

---

~~This is built on top of #115301, so I'll rebase and roll a reviewer once that lands.~~
r? `@ghost`
`@rustbot` label +A-code-coverage
2023-10-18 18:48:34 +00:00
..
assembly Automatically enable cross-crate inlining for small functions 2023-10-17 19:53:51 -04:00
auxiliary
codegen Automatically enable cross-crate inlining for small functions 2023-10-17 19:53:51 -04:00
codegen-units Automatically enable cross-crate inlining for small functions 2023-10-17 19:53:51 -04:00
coverage-map coverage: Store all of a function's mappings in function coverage info 2023-10-18 23:42:39 +11:00
debuginfo
incremental Bless incremental tests. 2023-10-06 15:46:11 +00:00
mir-opt coverage: Store expression data in function coverage info 2023-10-18 23:44:34 +11:00
pretty Preserve unicode escapes in format string literals when pretty-printing AST 2023-10-16 21:20:21 +02:00
run-coverage coverage: Regression test for functions with unreachable bodies 2023-10-01 14:44:27 +11:00
run-coverage-rustdoc
run-make Auto merge of #116814 - estebank:windows-ice-path, r=petrochenkov 2023-10-18 07:45:56 +00:00
run-make-fulldeps Add Config::hash_untracked_state callback 2023-10-14 15:54:26 +00:00
run-pass-valgrind
rustdoc rustdoc: move ICE test to rustdoc-ui 2023-10-16 18:02:11 -07:00
rustdoc-gui Auto merge of #115948 - notriddle:notriddle/logo-lockup, r=fmease 2023-10-11 06:28:36 +00:00
rustdoc-js Add regression test for #115480 2023-10-11 11:41:39 +02:00
rustdoc-js-std
rustdoc-json
rustdoc-ui Rollup merge of #111072 - Urgau:check-cfg-new-syntax, r=petrochenkov 2023-10-17 19:07:21 +02:00
ui Rollup merge of #116879 - aliemjay:revert-opaque-bubble, r=oli-obk 2023-10-18 14:24:52 +03:00
ui-fulldeps Rollup merge of #116787 - a-lafrance:span-internal-lint, r=oli-obk 2023-10-17 19:07:23 +02:00
COMPILER_TESTS.md