Skip to content

#![feature(inherent_associated_types)] fails compilation of derive macro serde::Deserialize #143952

@JulianKnodt

Description

@JulianKnodt

Enabling the trait #![feature(inherent_associated_types)] will lead to a compilation failure for serde::Deserialize regardless of the struct content on rustc 1.90.0 nightly. I lasted tested on 1.88 nightly, and it seemed to work fine, so this is likely a regression in the feature.

I did a brief check for similar issues, but didn't see anything related to this feature flag. I'm actually not sure why I had it enabled, I can just turn it off and compilation was fine otherwise.

Serde Issue

I tried this code:

Playground Link

I expected to see this happen: Compilation succeeds with or without the feature flag

Instead, this happened: Compilation fails with the feature flag

Meta

rustc --version --verbose:

rustc 1.90.0-nightly (667787527 2025-07-02)
binary: rustc
commit-hash: 6677875279b560442a07a08d5119b4cd6b3c5593
commit-date: 2025-07-02
host: aarch64-apple-darwin
release: 1.90.0-nightly
LLVM version: 20.1.7

Backtrace

error[E0220]: associated type `Value` not found for `__Visitor<'de>` in the current scope
   --> src/sdf.rs:803:61
    |
803 | #[derive(Default, Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
    |                                                             ^^^^^^^^^^^
    |                                                             |
    |                                                             associated item not found in `__Visitor<'de>`
    |                                                             associated type `Value` not found for this struct
    |
    = note: the associated type was found for
            
    = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions