Skip to content

False positive "not all trait items implemented" (E0046) for items with Self: Sized for non-primitive unsized types #22353

@lansyin

Description

@lansyin

rust-analyzer version: rust-analyzer version: 0.3.2896-standalone (e266f5c 2026-05-10)

rustc version: rustc 1.95.0 (59807616e 2026-04-14)

editor or extension: VSCode & VSCode Insiders

code snippet to reproduce:

#[allow(dead_code)]
fn main() {
    trait State {
        type Repr;

        fn into_repr(self) -> Self::Repr
        where
            Self: Sized;
    }

    struct Stateless([()]);

    impl State for Stateless {
       //^^^^^ not all trait items implemented, missing: `fn into_repr` (E0046)
        type Repr = ();
    }
}

It compiles on Rust 1.95.0 Stable. This was previously raised in #19962, but the fix in #19963 only adds filtering for primitives. I attempted to implement a proper fix myself, but I’m still new to RA and unfortunately wasn’t able to finish it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reportingC-bugCategory: bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions