-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
dead_code lint wrongly warns about "never used" functions that are, in fact used #126289
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.L-dead_codeLint: dead_codeLint: dead_codeP-mediumMedium priorityMedium priorityT-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.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.L-dead_codeLint: dead_codeLint: dead_codeP-mediumMedium priorityMedium priorityT-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.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
Output with 1.79.0:
nothing
Output with 1.80.0:
The original code didn't have the
#[allow(unused)], which was added because of the "never constructed" dead_code lint, which I guess would be #126169. Adding a constructor does make the function never used errors go away, so it seems#[allow(unused)]doesn't have enough power.