-
Notifications
You must be signed in to change notification settings - Fork 13.6k
coverage: Treat #[automatically_derived]
as #[coverage(off)]
#144560
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
Conversation
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
Some changes occurred in compiler/rustc_attr_parsing Some changes occurred in compiler/rustc_attr_data_structures Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
I have also taken this opportunity to rename some of the coverage-attribute data structures introduced by #143891. |
It would be nice to include this nuance somewhere. Ideally we'd have some documentation for when an item is instrumented that it would be easy to add this to, but that probably doesn't exist yet. @bors r+ rollup |
☔ The latest upstream changes (presumably #144377) made this pull request unmergeable. Please resolve the merge conflicts. |
This patch also prepares the affected code in `coverage_attr_on` for some subsequent changes.
Rebased to fix trivial conflict. @bors r=compiler-errors |
coverage: Treat `#[automatically_derived]` as `#[coverage(off)]` One of the contributing factors behind #141577 (comment) was the presence of derive-macro-generated code containing nested closures. Coverage instrumentation already has a heuristic for skipping code marked with `#[automatically_derived]` (#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.
coverage: Treat `#[automatically_derived]` as `#[coverage(off)]` One of the contributing factors behind #141577 (comment) was the presence of derive-macro-generated code containing nested closures. Coverage instrumentation already has a heuristic for skipping code marked with `#[automatically_derived]` (#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.
Yielding to rollup: @bors retry |
Rollup of 6 pull requests Successful merges: - #144560 (coverage: Treat `#[automatically_derived]` as `#[coverage(off)]`) - #144566 (Simplify `align_of_val::<[T]>(…)` → `align_of::<T>()`) - #144587 (expand: Micro-optimize prelude injection) - #144589 (Account for `.yield` in illegal postfix operator message) - #144615 (Make resolve_fn_signature responsible for its own rib.) - #144634 (Fix typo in `DropGuard` doc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #144560 - Zalathar:auto-derived, r=compiler-errors coverage: Treat `#[automatically_derived]` as `#[coverage(off)]` One of the contributing factors behind #141577 (comment) was the presence of derive-macro-generated code containing nested closures. Coverage instrumentation already has a heuristic for skipping code marked with `#[automatically_derived]` (#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.
One of the contributing factors behind #141577 (comment) was the presence of derive-macro-generated code containing nested closures.
Coverage instrumentation already has a heuristic for skipping code marked with
#[automatically_derived]
(#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.