-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Lint regression: dead_code ignores #[allow(dead_code)] on traits #144060
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.L-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).P-lowLow priorityLow 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-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Milestone
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.L-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).P-lowLow priorityLow 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-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=1991c4121122ea00f92d73867bb5f048
Current output
Desired output
No lint
Rationale and extra context
roundtripis used in an instance oftrait Fooso it isn't dead.Fooisn't used, but with it beingallowed I don't think the check should propagate back elsewhere.E.g.
bardoesn't get a lint in this case:This regressed in #143519, cc @mu001999
Rust Version
searched nightlies: from nightly-2025-05-31 to nightly-2025-07-15
regressed nightly: nightly-2025-07-14
searched commit range: bfc046a...e9182f1
regressed commit: 56835d7
bisected with cargo-bisect-rustc v0.6.10
Host triple: aarch64-apple-darwin
Reproduce with:
cargo bisect-rustc --start 2025-05-31 --end 2025-07-15 --without-cargo --script=rustc -- a.rs