Open
Description
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`.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
tesuji commentedon Jun 17, 2020
Note: Document build pass in user crate:
jyn514 commentedon Jun 17, 2020
What happens if you use
crate::ops::Deref
instead?jyn514 commentedon Jun 17, 2020
Actually this might be a markdown issue, does
[Deref::Target](core::ops::Deref)
work in libcore?Manishearth commentedon Jun 17, 2020
@lzutao
core::ops::Deref
will never work in the core crate, crates do not know their own names typicallyManishearth commentedon Jun 17, 2020
@jyn514 no, it's not a markdown issue
jyn514 commentedon Jun 17, 2020
@rustbot modify labels: T-rustdoc A-intra-doc-links D-confusing
jplatte commentedon Jun 17, 2020
Which can be worked around with an
extern crate self as foo;
in the crate root, in case anybody needs that (I've previously required it to get a proc macro working both inside its "parent crate" and outside of it).[-]Cannot use intra-doc-link in core crate[/-][+]intra-rustdoc-link: Cannot use core in core crate[/+]tesuji commentedon Jun 17, 2020
Oh, using
[`crate::path`]
works correctly. It is kind of confusing through.Manishearth commentedon Jun 17, 2020
I don't see how:
cratename::foo
never works in paths within the same cratetesuji commentedon Jun 18, 2020
I cannot use
std::
doc link prefix also.@Manishearth
You have a point. But for me what makes this confusing is that in doctest
I have to import items by crate name. But in doc link I don't have to.
26 remaining items