Open
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