Skip to content

intra-rustdoc-link: Cannot use core in core crate #73445

Open
@tesuji

Description

@tesuji

I tried to document this code in libcore (./x.py doc src/libcore):

impl<T: Deref, E> Result<T, E> {
    /// Converts from `Result<T, E>` (or `&Result<T, E>`) to `Result<&<T as Deref>::Target, &E>`.
    ///
    /// [`core::ops::Deref`]
    pub fn as_deref(&self) -> Result<&T::Target, &E>;
}

I expected to see the above code build pass.

Instead, this happened: Build failed the following errors:

 Documenting core v0.0.0 (/home/lzutao/fork/rust/compiler/src/libcore)
error: `[core::ops::Deref]` cannot be resolved, ignoring it.
    --> src/libcore/result.rs:1151:68
     |
1151 |     /// Coerces the [`Ok`] variant of the original [`Result`] via [`core::ops::Deref`]
     |                                                                    ^^^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
     |
note: the lint level is defined here
    --> src/libcore/lib.rs:64:9
     |
64   | #![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

error: Could not document `core`.

cc #43466
cc @Manishearth @GuillaumeGomez @jyn514

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameD-confusingDiagnostics: Confusing error or lint that should be reworked.S-blockedStatus: Blocked on something else such as an RFC or other implementation work.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