-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Dead code lint should include unused default trait methods in the unused chain #118139
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
shepmaster
added
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Nov 21, 2023
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Nov 21, 2023
Apparently, not warning on trait items is known and explicit. rust/compiler/rustc_passes/src/dead.rs Line 1044 in 2f8d81f
|
I half expected that to be the case. I have two parallel thoughts:
|
@rustbot claim |
#41883 is the issue about making traits / trait methods detected by the dead code lint. |
saethlin
removed
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Nov 26, 2023
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Jan 20, 2024
Make traits / trait methods detected by the dead code lint Fixes rust-lang#118139 and rust-lang#41883
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Jan 20, 2024
Make traits / trait methods detected by the dead code lint Fixes rust-lang#118139 and rust-lang#41883
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jan 21, 2024
Make traits / trait methods detected by the dead code lint Fixes rust-lang#118139 and rust-lang#41883
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jan 27, 2024
Make traits / trait methods detected by the dead code lint Fixes rust-lang#118139 and rust-lang#41883
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jan 28, 2024
Make traits / trait methods detected by the dead code lint Fixes rust-lang#118139 and rust-lang#41883
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 4, 2024
Make traits / trait methods detected by the dead code lint Fixes rust-lang#118139 and rust-lang#41883
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 5, 2024
Make traits / trait methods detected by the dead code lint Fixes rust-lang#118139 and rust-lang#41883
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
(in addition to the existing output)
Rationale and extra context
When I encountered this lint, I deleted the enum variant, but then got a compiler error as the variant was used within the trait's method. Nowhere did the compiler let me know that it's because the trait's method was unused.
Other cases
No response
Anything else?
It appears that trait methods are never reported as dead code — this example has no warnings:
However, I assume something is analyzing to see that the function is unused because otherwise the enum variant couldn't be transitively marked as unused.
The text was updated successfully, but these errors were encountered: