-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Inconsistent handling of #[coverage(..)] attributes that are malformed or misplaced #126658
Copy link
Copy link
Closed
Labels
A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)Area: Source-based code coverage (-Cinstrument-coverage)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-inconsistentDiagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)Area: Source-based code coverage (-Cinstrument-coverage)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-inconsistentDiagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
(Note: The coverage attribute is currently unstable; see #84605.)
While writing tests for
#[coverage(..)]for #84605, I encountered various inconsistencies in diagnostics for using the attribute with incorrect syntax or on inappropriate items.For example:
#[coverage]is silently permitted in various situations, even though it should never be legal.implblocks, ontrait, and onimpl Trait.#[coverage = "off"]results in different error messages than other kinds of incorrect syntax, and sometimes results in multiple errors for the same attribute.#[coverage]is permitted, which is incorrect.#[coverage(off)]or#[coverage(on)]on things other than functions/methods/closures sometimes results in an error, and sometimes only a warning.