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

#[no_coverage] renamed to #[coverage(off)] without a migration period #312

Closed
Zalathar opened this issue Sep 6, 2023 · 4 comments · Fixed by #314
Closed

#[no_coverage] renamed to #[coverage(off)] without a migration period #312

Zalathar opened this issue Sep 6, 2023 · 4 comments · Fixed by #314

Comments

@Zalathar
Copy link

Zalathar commented Sep 6, 2023

UPDATE(taiki-e): #[no_coverage] renamed to #[coverage(off)].

  • When using #[coverage(off)] in the new nightly, replace feature(no_coverage) with feature(coverage_attribute), no_coverage with coverage(off), and coverage-helper 0.1 with coverage-helper 0.2.
  • You can work around the "removed feature" error by pinning the nightly version.
  • When dependencies use unstable features and the error occurs, you can work around them by passing --no-cfg-coverage-nightly or/and --no-cfg-coverage flags, in many cases.

See rust-lang/rust#114656.

Apparently this has been intended for a while, but in August 2023 someone stepped up to actually implement the change, and it's now close to being merged into nightly.

When this happens, it will affect anyone who is following the advice at https://github.com/taiki-e/cargo-llvm-cov#exclude-function-from-coverage. Affected users will need to update their code to use the new attribute, or else temporarily pin to a nightly version from before the change.

@taiki-e taiki-e changed the title #[no_coverage] is being renamed to #[coverage(off)] #[no_coverage] will be removed and replaced with #[coverage(off)] Sep 6, 2023
@taiki-e
Copy link
Owner

taiki-e commented Sep 6, 2023

It is unfortunate that this is being removed without a migration period. (Despite what was discussed here.)

As for coverage-helper, once rust-lang/rust#114656 is merged, I plan to release a new 0.1.x version that does not generate #[no_coverage] in rustc versions where it does not exist, and 0.2.0 that generate #[coverage(off)].

I'm not sure what should be done about users who use #[no_coverage] without going through coverage-helper.

One way is to add a wrapper for #[no_coverage] to the coverage-helper. Combining the above plan with encouraging users to use this wrapper instead of #[no_coverage] would prevent users using the wrapper from running into this problem.
However, I'm not sure how useful that would be for users already using #[no_coverage].

@taiki-e taiki-e pinned this issue Sep 6, 2023
@taiki-e taiki-e changed the title #[no_coverage] will be removed and replaced with #[coverage(off)] #[no_coverage] will be removed without a migration period and replaced with #[coverage(off)] Sep 6, 2023
@taiki-e
Copy link
Owner

taiki-e commented Sep 6, 2023

Anyway thanks for the heads up.

@Zalathar
Copy link
Author

Zalathar commented Sep 6, 2023

The PR is currently waiting for another review, since the earlier CI run failed. So it may not be too late to speak up and ask for a migration period.

It doesn’t seem like supporting both for a while would be particularly onerous.

@taiki-e taiki-e changed the title #[no_coverage] will be removed without a migration period and replaced with #[coverage(off)] #[no_coverage] will be renamed to #[coverage(off)] without a migration period Sep 13, 2023
@taiki-e
Copy link
Owner

taiki-e commented Sep 13, 2023

@taiki-e taiki-e changed the title #[no_coverage] will be renamed to #[coverage(off)] without a migration period #[no_coverage] renamed to #[coverage(off)] without a migration period Sep 15, 2023
@taiki-e taiki-e unpinned this issue Dec 10, 2023
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 a pull request may close this issue.

2 participants