Skip to content

rustdoc-json: ICE with associated type in trait #98547

Closed
@Enselic

Description

@Enselic

Minimal reproducer with 1.64.0-nightly (20a6f3a8a 2022-06-25):

// src/lib.rs

pub trait Trait {
    type AssocType;
}

impl<T> Trait for T {
    type AssocType = Self;
}

pub struct S;
% RUSTDOCFLAGS='-Z unstable-options --output-format json' cargo +nightly doc --lib --no-deps  
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Item { id: Id("0:7:1558"), crate_id: 0, name: Some("AssocType"), span: Some(Span { filename: "src/lib.rs", begin: (8, 4), end: (8, 26) }), visibility: Default, docs: None, links: {}, attrs: [], deprecation: None, inner: Typedef(Typedef { type_: Generic("Self"), generics: Generics { params: [], where_predicates: [] } }) }`,
 right: `Item { id: Id("0:7:1558"), crate_id: 0, name: Some("AssocType"), span: Some(Span { filename: "src/lib.rs", begin: (8, 4), end: (8, 26) }), visibility: Default, docs: None, links: {}, attrs: [], deprecation: None, inner: Typedef(Typedef { type_: Generic("T"), generics: Generics { params: [], where_predicates: [] } }) }`', src/librustdoc/json/mod.rs:234:21

PR with a fix proposal: #98548

@rustbot labels +A-rustdoc-json +I-ICE +T-rustdoc

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-jsonArea: Rustdoc JSON backendI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-rustdocRelevant to the rustdoc 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