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

Use intra-doc-link to fix broken links #74061

Closed
wants to merge 1 commit into from
Closed

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Jul 5, 2020

This may fix broken links by missing Deref<Target = str> of String in #32553.

@ehuss
Copy link
Contributor

ehuss commented Jul 5, 2020

Just FYI, there is someone working on the string page in #73804.

src/libcore/str/mod.rs Outdated Show resolved Hide resolved
src/libcore/str/mod.rs Outdated Show resolved Hide resolved
src/libcore/str/mod.rs Outdated Show resolved Hide resolved
@tesuji
Copy link
Contributor Author

tesuji commented Jul 5, 2020

Just FYI, there is someone working on the string page in #73804.

Thanks ehuss, I am willing to rebase on #73804 .

@tesuji tesuji force-pushed the link branch 5 times, most recently from 492be3e to e6864c0 Compare July 10, 2020 08:04
@tesuji tesuji marked this pull request as ready for review July 11, 2020 01:30
@tesuji tesuji changed the title [WIP] Use intra-doc-link to fix broken links Use intra-doc-link to fix broken links Jul 11, 2020
@tesuji
Copy link
Contributor Author

tesuji commented Jul 15, 2020

r? @ehuss

@ehuss
Copy link
Contributor

ehuss commented Jul 16, 2020

There seems to be some regressions, particularly with primitive links like char. Either they are absolute links to nightly (https://doc.rust-lang.org/nightly/std/primitive.char.html) or they are links to the char module (/std/char/index.html). Perhaps they should use the type@char syntax (or whatever it is now)? I see this also with a few other primitives.

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2020

type@char syntax should work (but you'll need [char][type@char] for it to look nice: #65354).

absolute links to nightly (https://doc.rust-lang.org/nightly/std/primitive.char.html)

Hmm, I thought we fixed this in #74077 ... does this happen in documentation for core or only in std?

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2020

If it happens only in std, then it's because rustdoc assumes the docs for primitives aren't available if they aren't part of the current crate, I tried debugging this in #74077 (comment) without success. cc @sethp

@ehuss
Copy link
Contributor

ehuss commented Jul 16, 2020

For this PR, the primitive links only seem to be incorrect on alloc and core.

For example, the top of the page std/str/fn.from_utf8.html has correct links to u8 and str, but the same page at alloc/str/fn.from_utf8.html uses the remote links.

@bors
Copy link
Contributor

bors commented Jul 16, 2020

☔ The latest upstream changes (presumably #74388) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 16, 2020
@tesuji
Copy link
Contributor Author

tesuji commented Jul 16, 2020

type@char syntax

type@char syntax in alloc point to absolute link https://doc.rust-lang.org/nightly/std/primitive.char.html,
in std it points to local link /std/char/index.html .

/// [`bytes`]: #method.bytes
/// [`chars`]: #method.chars
/// [`bytes`]: str::bytes
/// [`chars`]: str::chars
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In alloc, this points to https://doc.rust-lang.org/nightly/std/primitive.str.html#method.bytes .
But in std, this points to absolute local link: http://0.0.0.0:8000/home/lzutao/fork/rust/compiler/src/liballoc/std/primitive.str.html#method.bytes

And yes, I run http server in doc directory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file an issue for this bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is related to cross crate re-exports. So I bet the behavior will change when #73101 lands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After stage1, the location in std is Ok http://0.0.0.0:8000/std/primitive.str.html#method.bytes .

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2020

in std it points to local link /std/char/index.html

That's the module, not the primitive type. That was recently fixed (last few days), have you rebased since? You will need to build with stage 1 rustdoc, not the beta compiler.

@tesuji
Copy link
Contributor Author

tesuji commented Jul 16, 2020

Thanks for the tips. After stage1, type@char in std points to correct position at http://0.0.0.0:8000/std/primitive.char.html ,
still in alloc it points to a remote link.

@jyn514
Copy link
Member

jyn514 commented Jul 16, 2020

Ok, if you want that to work in intra-doc links you'll have to wait for #73101 then. Hopefully it will land in the next week or so.

@ollie27
Copy link
Member

ollie27 commented Jul 18, 2020

This may fix #32553.

This won't actually fix #32553 because it is about the missing Methods from Deref<Target=str> section on the alloc::string::String page. This may be able to fix the broken links that were caused by that though.

@tesuji
Copy link
Contributor Author

tesuji commented Jul 19, 2020

Closing in favor of #74485 .

@tesuji tesuji closed this Jul 19, 2020
@tesuji tesuji deleted the link branch July 19, 2020 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants