intra-rustdoc-link: Cannot use core in core crate · Issue #73445 · rust-lang/rust (original) (raw)

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