Skip to content

Intra-doc links are not resolved in inherited docs from upstream traits #73829

Closed

Description

I tried this code:

There are two crates, outer and inner. outer depends on inner.

outer/src/lib.rs:

use inner::SomeTrait;

pub struct SomeStruct;

impl SomeTrait for SomeStruct {
    fn foo() {}
}

outer/inner/src/lib.rs:

/// this is a trait
pub trait SomeTrait {
    /// this is a method for [SomeTrait]
    fn foo();
}

pub mod bar {
    use super::SomeTrait;

    pub struct BarStruct;

    impl SomeTrait for BarStruct {
        fn foo() {}
    }
}

I expected to see this happen: The trait implementation docs for SomeTrait::foo on outer::SomeStruct link to SomeTrait.

Instead, this happened: The link is not resolved, and there is no warning or indication that it failed. Here is a screenshot of the generated docs:

foo

Notably, the docs on inner::bar::BarStruct resolve correctly despite being in a different module, indicating that this is a cross-crate issue.

Meta

rustc --version --verbose:

rustc 1.44.1 (c7087fe00 2020-06-17)
binary: rustc
commit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7
commit-date: 2020-06-17
host: x86_64-unknown-linux-gnu
release: 1.44.1
LLVM version: 9.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-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