about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/check_pointers.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-07-29 23:50:35 +1000
committerGitHub <noreply@github.com>2025-07-29 23:50:35 +1000
commitf8370285cf81e8af24c7f95b77cbb83c3d6db1cf (patch)
treebbe35d24a1ca049bb13fb494e3004152d6545b1f /compiler/rustc_mir_transform/src/check_pointers.rs
parent7278554d82fa474a4e8b5c67afb009e11e41a841 (diff)
parent682f744f89e1c014e91b2fd7058c75f2056ac870 (diff)
downloadrust-f8370285cf81e8af24c7f95b77cbb83c3d6db1cf.tar.gz
rust-f8370285cf81e8af24c7f95b77cbb83c3d6db1cf.zip
Rollup merge of #144560 - Zalathar:auto-derived, r=compiler-errors
coverage: Treat `#[automatically_derived]` as `#[coverage(off)]`

One of the contributing factors behind https://github.com/rust-lang/rust/issues/141577#issuecomment-3120667286 was the presence of derive-macro-generated code containing nested closures.

Coverage instrumentation already has a heuristic for skipping code marked with `#[automatically_derived]` (rust-lang/rust#120185), because derived code is usually not worth instrumenting, and also has a tendency to trigger vexing edge-case bugs in coverage instrumentation or coverage codegen.

However, the existing heuristic only applied to the associated items directly within an auto-derived impl block, and had no effect on closures or nested items within those associated items.

This PR therefore extends the search for `#[coverage(..)]` attributes to also treat `#[automatically_derived]` as an implied `#[coverage(off)]` for the purposes of coverage instrumentation.

---

This change doesn’t rule out an entire category of bugs, because it only affects code that actually uses the auto-derived attribute. But it should reduce the overall chance of edge-case macro span bugs being observed in the wild.
Diffstat (limited to 'compiler/rustc_mir_transform/src/check_pointers.rs')
0 files changed, 0 insertions, 0 deletions