Skip to content

rustdoc intra-doc links: false positive on trait impls from other crates #55907

Closed
@QuietMisdreavus

Description

@QuietMisdreavus

In crate inner:

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

/// this is an impl for [SomeTrait].
impl<T> SomeTrait for T {
    fn qwop() {}
}

Crate outer only needs to link against inner, and since my testbed is set to 2018 it's just the following:

#[doc(no_inline)]
pub use inner;

Building docs for outer will generate false positives for the items in inner: (My testbed uses asdf for outer and qwop for inner, but the message should be the same)

$ cargo +nightly doc
 Documenting asdf v0.1.0 (/home/misdreavus/git/asdf)
warning: `[SomeTrait]` cannot be resolved, ignoring it...
 --> /home/misdreavus/git/asdf/qwop/src/lib.rs:7:26
  |
7 | /// this is an impl for [SomeTrait].
  |                          ^^^^^^^^^ cannot be resolved, ignoring
  |
  = note: #[warn(intra_doc_link_resolution_failure)] on by default
  = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[SomeTrait]` cannot be resolved, ignoring it...
 --> /home/misdreavus/git/asdf/qwop/src/lib.rs:3:31
  |
3 |     /// this is a method for [SomeTrait]
  |                               ^^^^^^^^^ cannot be resolved, ignoring
  |
  = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

    Finished dev [unoptimized + debuginfo] target(s) in 2.74s

Metadata

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