Skip to content

rustdoc reports error twice for ambiguous (inherent) associated type #88593

Closed
@camelid

Description

@camelid
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

pub struct Struct;

impl Struct {
    pub type AssocTy = usize;
    pub const AssocConst: Self::AssocTy = 42;
}

rustc only emits the error once, but rustdoc emits it twice. rustdoc output:

error[E0223]: ambiguous associated type
  --> $DIR/ambiguous-inherent-assoc-ty.rs:11:27
   |
LL |     pub const AssocConst: Self::AssocTy = 42;
   |                           ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<Struct as Trait>::AssocTy`

error[E0223]: ambiguous associated type
  --> $DIR/ambiguous-inherent-assoc-ty.rs:11:27
   |
LL |     pub const AssocConst: Self::AssocTy = 42;
   |                           ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<Struct as Trait>::AssocTy`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0223`.

cc #88573

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)C-bugCategory: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]`T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions