Skip to content

rustdoc generates broken "Read more" links when the destination crate doesn't have a URL #74222

Open
@ollie27

Description

@ollie27

I tried this code:

foo.rs:

#![crate_type = "rlib"]
pub struct FooStruct;
pub trait FooTrait {
    /// docs
    ///
    /// more docs
    fn foo_method();
}
impl FooTrait for FooStruct {
    fn foo_method() {}
}

bar.rs:

extern crate foo;
pub use foo::FooStruct;

running rustc foo.rs && rustdoc -L . bar.rs so only bar is documented.

I expected to see this happen:

When the docs for bar are documented the page for FooStruct shouldn't contain any broken "Read more" links.

Instead, this happened:

The "Read more" link for foo_method on the page for FooStruct points to #tymethod.foo_method which doesn't go anywhere. It should point to the documentation for FooTrait but as that page doesn't exist the "Read more" link shouldn't exist at all. The link works fine if docs for foo are also generated or pub use foo::FooTrait; is added to bar.rs.

Meta

rustc --version --verbose:

rustc 1.46.0-nightly (5db778aff 2020-07-09)
binary: rustc
commit-hash: 5db778affee7c6600c8e7a177c48282dab3f6292
commit-date: 2020-07-09
host: x86_64-pc-windows-msvc
release: 1.46.0-nightly
LLVM version: 10.0

Metadata

Metadata

Assignees

Labels

A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateA-rustdoc-uiArea: Rustdoc UI (generated HTML)C-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