Skip to content

rustdoc generates broken link for inherent methods on primitive types on source code pages under --generate-link-to-definition #156707

@fmease

Description

@fmease

Reproducer 0:

fn scope() {
    let _ = 0usize.saturating_add(1);
}

On the source code page, saturating_add links to https://doc.rust-lang.org/nightly/core/foreigntype.num.html#method.saturating_add which is broken. It should link to https://doc.rust-lang.org/nightly/std/primitive.usize.html#method.saturating_add or https://doc.rust-lang.org/nightly/core/primitive.usize.html#method.saturating_add instead.

Reproducer 1:

fn scope() {
    let _ = false.then_some(());
}

On the source code page, then_some links to https://doc.rust-lang.org/nightly/core/foreigntype.bool.html#method.then_some which is broken. It should link to https://doc.rust-lang.org/nightly/std/primitive.bool.html#method.then_some or https://doc.rust-lang.org/nightly/core/primitive.bool.html#method.then_some instead.

Metadata

Metadata

Labels

A-link-to-definitionrustdoc --generate-link-to-definition nightly-only featureC-bugCategory: This is a bug.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. When possible, use a F-* label instead.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions