Skip to content
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 warning not emitted for unused associated constant #114730

Closed
Freax13 opened this issue Aug 11, 2023 · 5 comments
Closed

dead_code warning not emitted for unused associated constant #114730

Freax13 opened this issue Aug 11, 2023 · 5 comments
Labels
C-bug Category: This is a bug. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Freax13
Copy link
Contributor

Freax13 commented Aug 11, 2023

Code

I tried this code:

struct Foo(u16);

pub fn use_foo() {
    let _ = Foo(0);
}

impl Foo {
    pub const BAR: Self = Self(123);
}

impl PartialEq<Foo> for u16 {
    fn eq(&self, other: &Foo) -> bool {
        *self == other.0
    }
}

I expected to see this happen: I expected to see a dead_code warning for Foo::BAR.

Instead, this happened: No warning is emitted.

Version it worked on

It most recently worked on: Rust 1.70

Version with regression

rustc --version --verbose:

rustc 1.71.1 (eb26296b5 2023-08-03)
binary: rustc
commit-hash: eb26296b556cef10fb713a38f3d16b9886080f26
commit-date: 2023-08-03
host: x86_64-unknown-linux-gnu
release: 1.71.1
LLVM version: 16.0.5

Backtrace

N/A

@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged

@Freax13 Freax13 added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Aug 11, 2023
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-untriaged Untriaged performance or correctness regression. labels Aug 11, 2023
@Freax13
Copy link
Contributor Author

Freax13 commented Aug 11, 2023

searched nightlies: from nightly-2023-03-04 to nightly-2023-05-27
regressed nightly: nightly-2023-05-15
searched commit range: 2c41369...18bfe5d
regressed commit: ad6ab11

bisected with cargo-bisect-rustc v0.6.6

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 1.69.0 --end 1.71.0 --regress success --access github -vvvvv -c clippy -- clippy -- -D warnings 

@lqd
Copy link
Member

lqd commented Aug 11, 2023

That's #111425, cc PR author @Bryanskiy and reviewer @petrochenkov

@saethlin saethlin added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 11, 2023
@Bryanskiy
Copy link
Contributor

Fixed in #112670

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Aug 12, 2023
@lqd
Copy link
Member

lqd commented Aug 12, 2023

Indeed, it's fixed on nightly, as well as beta. The fix will land on stable in 12 days. I'll close this but feel free to reopen in the highly unlikely chance that it appears on the next stable.

Thanks for opening an issue!

@lqd lqd closed this as completed Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants