Skip to content

Conversation

GuillaumeGomez
Copy link
Member

Fixes #104064.

As mentioned in the issue, I'm not super happy about this fix which is more a hack rather than a sound-proof solution. However I couldn't find a better way to fix it.

r? @aDotInTheVoid

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 3, 2023
@aDotInTheVoid
Copy link
Member

Given that primitives are handled with the DisplayDefId machinery, we're not using ItemId::Primitive here. What does is it used for?

This PR should also remove the code path for ItemId::Primitive to clairify that its not used.

match item_id {
ItemId::DefId(did) => Id(format!("{}", DisplayDefId(did, tcx, name))),
ItemId::Blanket { for_, impl_id } => {
Id(format!("b:{}-{}", DisplayDefId(impl_id, tcx, None), DisplayDefId(for_, tcx, name)))
}
ItemId::Auto { for_, trait_ } => {
Id(format!("a:{}-{}", DisplayDefId(trait_, tcx, None), DisplayDefId(for_, tcx, name)))
}
ItemId::Primitive(ty, krate) => Id(format!("p:{}:{}", krate.as_u32(), ty.as_sym())),
}

-      ItemId::Primitive(ty, krate) => Id(format!("p:{}:{}", krate.as_u32(), ty.as_sym())), 
+      ItemId::Primitive(_, _) => unreachable!(),

I've tested this localy, but github won't let me suggest changes for lines "to far" from the changed lines.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 4, 2023
@GuillaumeGomez
Copy link
Member Author

ItemId::Primitive exists for the generation of the search index. But at this point, I think we could maybe remove it. To be investigated.

@GuillaumeGomez
Copy link
Member Author

I removed the match pattern for the primitive type.

@aDotInTheVoid
Copy link
Member

r=me when CI passes.

@GuillaumeGomez
Copy link
Member Author

@bors r=aDotInTheVoid

@bors
Copy link
Collaborator

bors commented Jan 4, 2023

📌 Commit c9ebd73 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 4, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 5, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#106391 (rustdoc: allow popover child links to work)
 - rust-lang#106398 (Fix a few clippy lints in libtest)
 - rust-lang#106412 (Fix link generation for local primitive types in rustdoc JSON output)
 - rust-lang#106437 (rustdoc: fix buggy JS check for absolute URL)
 - rust-lang#106451 (Merge borrowck permission checks)
 - rust-lang#106460 (Move tests)
 - rust-lang#106461 (docs: fix broken link "search bar")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d214402 into rust-lang:master Jan 5, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 5, 2023
@GuillaumeGomez GuillaumeGomez deleted the fix-links-to-primitive-rustdoc-json branch January 5, 2023 09:47
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Jan 11, 2023
…, r=notriddle

Remove unneeded ItemId::Primitive variant

As I mentioned [here](rust-lang#106412 (comment)), I wondered if `ItemId::Primitive` was actually used for anything. Apparently, it seems so because removing it led to no changes as far as I and tests could see.

r? `@notriddle`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Rustdoc JSON] Primitive types in core are missing from the index
4 participants