-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`L-dead_codeLint: dead_codeLint: dead_codeL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).S-blockedStatus: Blocked on something else such as an RFC or other implementation work.Status: Blocked on something else such as an RFC or other implementation work.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
On nightly, the following code triggers dead_code
even though it should not.
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
fn main() {
let _: Struct::Item = ();
}
struct Struct;
impl Struct { type Item = (); }
warning: associated type `Item` is never used
--> min.rs:9:20
|
9 | impl Struct { type Item = (); }
| ----------- ^^^^
| |
| associated type in this implementation
|
= note: `#[warn(dead_code)]` on by default
warning: 1 warning emitted
Actually until recently, dead_code
was never triggered at all for inherent associated types.
PR #110277 was just merged which started visiting more associated items exposing this bug.
The dead_code
pass never considers IATs as live symbols (live_symbols
) even in cases where they should be.
This feels like a regression but technically speaking it is not:
We switched from one extreme to the other. Thus not marking as such.
@rustbot label A-lint F-inherent_associated_types requires-nightly
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.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`L-dead_codeLint: dead_codeLint: dead_codeL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).S-blockedStatus: Blocked on something else such as an RFC or other implementation work.Status: Blocked on something else such as an RFC or other implementation work.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Type
Projects
Status
In Progress