-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
intra-doc links: crate::
considers the traits in the crate scope, not the current scope
#78696
Comments
Slightly smaller: // Uncomment this and the warning will go away
// use crate::io::Read;
pub mod io {
pub trait Read {
fn read(&mut self);
}
}
pub mod bufreader {
//! [`crate::TcpStream::read`]
use crate::io::Read;
}
pub struct TcpStream;
impl crate::io::Read for TcpStream {
fn read(&mut self) {
}
} |
The issue is that rustdoc thinks the trait isn't in scope for some reason:
|
Because it's resolving the scope of the crate, because of the hack I did to fix |
crate::
considers the traits in the crate scope, not the current scope
@petrochenkov how hard would it be to allow Using $crate would fix this issue and also some other hacks in rustdoc (see #77253). |
|
Mentoring instructions: everywhere that currently calls
There are many different calls to Once you've passed the correct span, change the hack in rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 1014 to 1021 in b385598
to instead replace crate:: with $crate:: . Also remove the modification of module_id, which is what will actually fix #78696.
|
Fixed in #95337. |
…rieb Remove an old hack for rustdoc Since rust-lang#78696 has been resolved
…rieb Remove an old hack for rustdoc Since rust-lang#78696 has been resolved
Rollup merge of rust-lang#121310 - GrigorenkoPV:doc-smallfix, r=Nilstrieb Remove an old hack for rustdoc Since rust-lang#78696 has been resolved
I tried this code:
I expected to see this happen: Rustdoc should complete with no warnings
Instead, this happened:
Only the following warning is output by rustdoc
If you uncomment the line as it says, the warning goes away.
Meta
rustc +stage2 --version --verbose
:Commit hash: b202532
Here's a crate that repros this issue: https://github.com/pitaj/rustdoc-78006-repro
@rustbot modify labels: T-doc, A-intra-doc-links
@jyn514 Here's the repro I promised.
First came across this in #78006
The text was updated successfully, but these errors were encountered: