Skip to content

Intra-doc links do not resolve associated items for blanket impls #78800

Open
@jyn514

Description

I tried this code:

pub trait Trait {
    fn f();
}
impl<T> Trait for T {
    fn f() {}
}

pub mod inner {
    use crate::Trait;
    /// Link to [S::f]
    pub struct S;
}

I expected to see this happen: The link resolves to <S as Trait>::f

Instead, this happened: rustdoc can't resolve the link:

warning: unresolved link to `S::f`
  --> blanket.rs:10:18
   |
10 |     /// Link to [S::f]
   |                  ^^^^ the struct `S` has no field or associated item named `f`
   |
   = note: `#[warn(broken_intra_doc_links)]` on by default

Meta

rustdoc +nightly --version: rustdoc 1.49.0-nightly (ffa2e7ae8 2020-10-24)

cc @seeplusplus

After seeing #78761 I'm strongly considering getting rid of blanket impls altogether, clearly no one has been using them or they would have opened an issue. @Manishearth what do you think?

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-trait-systemArea: Trait systemC-bugCategory: This is a bug.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