-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.
Description
Code
enum E {
V(),
}
impl E {
#[expect(non_snake_case)]
fn V() {}
}
fn main() {
let _: E = E::V();
}
Current output
warning: associated function `V` is never used
--> src/main.rs:7:8
|
5 | impl E {
| ------ associated function in this implementation
6 | #[expect(non_snake_case)]
7 | fn V() {}
| ^
|
= note: `#[warn(dead_code)]` on by default
Desired output
warning: associated function `V` is never used
--> src/main.rs:7:8
|
5 | impl E {
| ------ associated function in this implementation
6 | #[expect(non_snake_case)]
7 | fn V() {}
| ^
|
= note: `#[warn(dead_code)]` on by default
= note: this function is shadowed by the `E::V` variant and can't be called
Rationale and extra context
Tuple variants always shadow methods. If a method has the same name as a variant it is uncallable.
Rust Version
1.87.0
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.