Skip to content

Rustdoc can't create link to trait implementation with generics ([link](#impl-Trait-for-Type<G1, G2>)) #105600

Open
@StackOverflowExcept1on

Description

@StackOverflowExcept1on

I tried this code: (bit modified, taken from https://github.com/StackOverflowExcept1on/simple-graph/blob/master/simple-graph/src/graph.rs)

/// ### Serialization to [`String`] in Trivial Graph Format
/// See [`impl<V, E> Display for Graph<V, E>`](#impl-Display-for-Graph<V, E>)
///
/// ### Deserialization from [`&str`] in Trivial Graph Format
/// See [`impl<V, E> FromStr for Graph<V, E>`](#impl-FromStr-for-Graph<V%2C%20E>)

I expected to see this happen: you can create link in rustdoc to #impl-Trait-for-Type<Generic1, Generic2, Generic3, ...>
image1

Instead, this happened: without manually URL-encoding rustdoc can't create link to trait implementation
image2

Fast way to reproduce issue with rustdoc

git clone https://github.com/StackOverflowExcept1on/rustdoc-issue.git
cd rustdoc-issue
cargo doc
firefox target/doc/rustdoc_issue/struct.Type.html

Meta

rustc --version --verbose:

rustc 1.68.0-nightly (bdb07a8ec 2022-12-11)
binary: rustc
commit-hash: bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4
commit-date: 2022-12-11
host: x86_64-unknown-linux-gnu
release: 1.68.0-nightly
LLVM version: 15.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-feature-requestCategory: A feature request, i.e: not implemented / a PR.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