-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Item used in (unused) item named _name is still deemed dead #142075
Copy link
Copy link
Open
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.L-dead_codeLint: dead_codeLint: dead_codeL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).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-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.L-dead_codeLint: dead_codeLint: dead_codeL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).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.
Code
Current output
Desired output
Rationale and extra context
I have created some modules. I want each of them to fail to compile if it is not correct. To that end, I instituted a
sanity_checkin the crate, which is called within each module asconst _SANITY_CHECK: () = crate::sanity_check();The problem is that, because the
_SANITY_CHECKconsts are obviously not used anywhere, the entiresanity_checkfunction is considered unused too. As one can tell, it is in fact very much used, and serves a very important purpose.I guess this could be worked around by renaming it to
_sanity_check, but in this case leaving the function actually unused would return no warnings, which is less than ideal.Other cases
Rust Version
Anything else?
No response