Repository navigation
Fix coverage annotation compatibility and test-only helpers - #8
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Projects that already use coverage attributes could fail with duplicate attributes or feature gates, while test-only methods and file-level test modules still entered coverage. Coverage now adds attributes only under the complement of existing conditions, leaving cfg evaluation to rustc. Preprocessing and coverage recognize test-only impls/methods and file-level
cfg(test)consistently, with separate edit visitors.Non-entry Rust files that parse as expression fragments are preserved by both commands, allowing simple
include!expressions. Cargo target entries must still parse as complete files, including custom entry paths. Other parse errors remain errors. Explicitcoverage(on)settings remain respected; fragment contents and macro-generated tests are not automatically rewritten.The change stays within coverage/preprocessing and their checks/docs. No new dependencies, compiler-flag overrides, fingerprinting, general cfg evaluator, or macro expansion were added. The one-run XML/JSON flow and coverage restoration remain in place.
Validation with nightly-2025-03-19 and cargo-llvm-cov 0.6.16:
scripts/check_coverage.pypassed 11 compatibility cases plus custom-entry rejection checks. It checks normal-library and test builds, feature enabled/disabled, unchanged test outcomes, production-only coverage, restored source bytes, and preprocessing offsets/removal.The compatibility script is now part of Linux CI. Concurrency, timeouts, and broader generation/repair recovery remain separate later work.
Linux CI passed for the branch run and PR run, including the new compatibility checks and full minimal pipeline.