Skip to content
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

Resolve crate in intra-doc links properly across crates #77253

Merged
merged 2 commits into from
Sep 29, 2020

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Sep 27, 2020

Closes #77193; see #77193 (comment) for an explanation of what's going on here.
This also fixes the BTreeMap docs that have been broken for a while; see the description on the second commit for why and how. Nope, see the second commit for why the link had to be changed.

r? @Manishearth
cc @dylni

@dylni note that this doesn't solve your original problem - now both with_code and crate::with_code will be broken links. However this will fix a lot of other broken links (in particular I think https://docs.rs/sqlx/0.4.0-beta.1/sqlx/query/struct.Query.html is because of this bug). I'll open another issue for resolving additional docs in the new scope.

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate labels Sep 27, 2020
@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 27, 2020
@jyn514 jyn514 changed the title Resolve crate properly across crates Resolve crate in intra-doc links properly across crates Sep 27, 2020
@jyn514
Copy link
Member Author

jyn514 commented Sep 27, 2020

I'll open another issue for resolving additional docs in the new scope.

#77254

@jyn514 jyn514 force-pushed the crate-link branch 3 times, most recently from 45250f4 to d4ca2ea Compare September 27, 2020 03:47
@dylni
Copy link
Contributor

dylni commented Sep 27, 2020

Thanks for keeping me updated.

Previously, `BTreeMap` tried to link to `crate::collections`, intending
for the link to go to `std/collections/index.html`. But `BTreeMap` is
defined in `alloc`, so after the fix in the previous commit, the links
instead went to `alloc/collections/index.html`, which has almost no
information.

This changes it to link to `index.html`, which only works when viewing
from `std::collections::BTreeMap`, the most common place to visit the
docs. Fixing it to work from anywhere would require the docs for
`std::collections` to be duplicated in `alloc::collections`, which in
turn would require HashMap to be `alloc` for intra-doc links to work
(rust-lang#74481).
@jyn514
Copy link
Member Author

jyn514 commented Sep 27, 2020

Ok, this is ready for review.

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 28, 2020

📌 Commit 4065846 has been approved by Manishearth

@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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 28, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 28, 2020
Resolve `crate` in intra-doc links properly across crates

Closes rust-lang#77193; see rust-lang#77193 (comment) for an explanation of what's going on here.
~~This also fixes the BTreeMap docs that have been broken for a while; see the description on the second commit for why and how.~~ Nope, see the second commit for why the link had to be changed.

r? @Manishearth
cc @dylni

@dylni note that this doesn't solve your original problem - now _both_ `with_code` and `crate::with_code` will be broken links. However this will fix a lot of other broken links (in particular I think https://docs.rs/sqlx/0.4.0-beta.1/sqlx/query/struct.Query.html is because of this bug). I'll open another issue for resolving additional docs in the new scope.
@bors
Copy link
Contributor

bors commented Sep 29, 2020

⌛ Testing commit 4065846 with merge 9e34b72...

@bors
Copy link
Contributor

bors commented Sep 29, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Manishearth
Pushing 9e34b72 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 29, 2020
@bors bors merged commit 9e34b72 into rust-lang:master Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross-crate-reexports Area: Documentation that has been re-exported from a different crate A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. merged-by-bors This PR was explicitly merged by bors. 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.

intra-doc links: crate means something different when an item is re-exported
7 participants