-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rustdoc treats primitive disambiguators incorrectly #80559
Comments
This is blocking #75807 and made #77875 (comment) unnecessarily difficult. |
@rustbot claim |
@jyn514 which arm do you mean to add the match guard to? |
@max-heller the one for telling if the resolved item is a primitive:
|
@jyn514 It looks like |
Oh hmm - the issue is that for primitives, rustdoc generates the anchor manually: rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 401 to 402 in a6bd524
def_id of the associated item in kind_side_channel instead, so you know later whether the anchor is a manual link (str#method.trim ) or whether it was generated by rustdoc.
|
Adding rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 394 to 398 in a6bd524
and adding the match guard seems to fix things, but also feels like a hack. |
I mean, all of |
Properly handle primitive disambiguators in rustdoc Fixes rust-lang#80559 r? `@jyn514` Is there a way to test that the generated intra-doc link is what I expect?
I tried this code:
//! [str::trim()]
I expected to see this happen: Rustdoc links to https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim.
Instead, this happened: Rustdoc gets confused that
()
means a function and thinks that the link is a primitive.Meta
rustdoc --version
:Relevant code:
rust/src/librustdoc/passes/collect_intra_doc_links.rs
Line 1181 in a6bd524
I think the fix is just to add
if self.kind_side_channel.is_none()
as a match guard.The text was updated successfully, but these errors were encountered: