Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anchors in intra doc link #62833

Closed
dtolnay opened this issue Jul 20, 2019 · 1 comment · Fixed by #66675
Closed

Anchors in intra doc link #62833

dtolnay opened this issue Jul 20, 2019 · 1 comment · Fixed by #66675
Assignees
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented Jul 20, 2019

lib.rs:

/// A!
///
/// # Errors
///
/// None?
pub struct A;

/// [x][A], [y][A#errors], [z]
///
/// [z]: A#errors
pub struct B;

The documentation of B is rendered by rustdoc as ` x, [y][A#errors], z `, in which the x link correctly points to the documentation of A as expected, the y link is unrendered, and the z link points to href="A#errors".

I would expect both y and z to have href="struct.A.html#errors".

Mentioning the tracking issue: #43466

@dtolnay dtolnay added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name labels Jul 20, 2019
@dtolnay
Copy link
Member Author

dtolnay commented Jul 20, 2019

Importantly, this should take into account the deduplication of anchors on the same page. In the following, [A#errors] should go to struct.A.html#errors and [A::f#errors] should go to struct.A.html#errors-1 (which is how the anchor is deduplicated today).

/// A!
///
/// # Errors
///
/// None?
pub struct A;

impl A {
    /// f!
    ///
    /// # Errors
    ///
    /// Also none.
    pub fn f() {}
}

/// [A#errors], [A::f#errors]
pub struct B;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants