Skip to content

Resolve intra-doc-links on Self for method #70802

Closed
@ghost

Description

I tried this code:

#![deny(intra_doc_link_resolution_failure)]


/// [Self::bar]
pub struct Works;

impl Works {
    pub fn bar() {}
}

pub struct Broken;

impl Broken {
    /// [Self::bar]
    pub fn bar() {}
}

I expected to see this happen:
Docs for Broken::bar is generated correctly by running cargo +nightly doc

Instead, this happened:
I'm getting this error

> cargo +nightly doc
 Documenting rust-playground v0.1.0 (/home/xliiv/workspace/rust-playground)
error: `[Self::bar]` cannot be resolved, ignoring it.
  --> src/lib.rs:14:10
   |
14 |     /// [Self::bar]
   |          ^^^^^^^^^ cannot be resolved, ignoring
   |
note: the lint level is defined here
  --> src/lib.rs:1:9
   |
1  | #![deny(intra_doc_link_resolution_failure)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

error: aborting due to previous error

error: Could not document `rust-playground`.

Caused by:
  process didn't exit successfully: `rustdoc --edition=2018 --crate-type lib --crate-name rust_playground src/lib.rs -o /home/xliiv/workspace/rust-playground/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/xliiv/workspace/rust-playground/target/debug/deps` (exit code: 1)

Meta

rustc --version --verbose:

> rustc --version --verbose
rustc 1.42.0 (b8cedc004 2020-03-09)
binary: rustc
commit-hash: b8cedc00407a4c56a3bda1ed605c6fc166655447
commit-date: 2020-03-09
host: x86_64-unknown-linux-gnu
release: 1.42.0
LLVM version: 9.0

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