-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
docs: Fix broken [pattern] link #73804
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @hanna-kruppe (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
I'm not quite sure either, but I believe this change would break the links when viewing this documentation from their "main" location, |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This is a known issue (#32129). @Manishearth Can we start using intra-doc-links in libstd? I noticed it is used sparingly in a few places, but I'm not certain if we can use it more frequently. If so, then in this I case I think the changes we can make are:
After making changes, make sure the links work in all the different pages they show up in. For example, for str it would be It would be great if we can get to the point where we can remove all the exclusions. |
@ehuss yeah you should totally be fine to use intra doc links Lang item should not matter, idk why |
Oh cool. @sethp Would you be OK trying to switch the problematic links over to intra-doc-links (at least for the str page)? |
These docs are available from two different paths: ``` /std/string/struct.String.html /std/primitive.str.html ``` Because they're at different levels, we can't construct a single relative path that works for both. However, we can ask the tooling to generate the correct relative path for each source with an `intra-doc-link`.
Hmm, I've gotten the pattern links fixed up per your suggestion in fb26b0c – when I ran I'm game to try finding and fixing the other issues mentioned in #32129 so we can remove the exclusion for some of the String pages, at least, but first I've come to ask for help. It takes about 40 minutes for |
Well, phew – once my |
|
See fb26b0c. This commit also removes the exclusion for the String docs page, but there's still a few broken links.
Just FYI, it looks like the tidy check failed due to a rustfmt error. I'm not sure why the bot didn't leave a comment about that. Running |
Oh, so it is – I've fixed the formatting, but I still expect broken links: at least locally, method links into primitives are going to a strange place. Specifically, I was seeing links for primitives as an absolute path: I think I just now have a fix that I'll be pushing up in a moment. |
At least locally, this required the fix in librustdoc: else, I was seeing broken links pointing into the source of the module being documented rather than linking to the `std/primitive.char.html#method.FOO` page as was likely intended.
Oh, interesting! I think it would be best to split any intra-doc fixes into a separate PR. cc @jyn514, I'm not sure if there is any in-progress work that would fix the issue encountered above? That is, the link Also, I noticed the Unfortunately, it doesn't look like intra-doc links are in a state where the string pages can be fixed. 😦 |
Not that I'm aware of, I just noticed the same issue today. If @sethp has a fix that's awesome, I'd be happy to review! #74063 is definitely a bug, I'll see if I can work on it tonight (should be a simple fix). #58699 is IMO expected behavior but we can change it if it's confusing. |
Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from rust-lang#73804.
…link, r=Dylan-DPC Use relative path for local links to primitives Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from rust-lang#73804.
…link, r=jyn514 Use relative path for local links to primitives Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from rust-lang#73804.
…link, r=jyn514 Use relative path for local links to primitives Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from rust-lang#73804.
…link, r=jyn514 Use relative path for local links to primitives Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from rust-lang#73804.
…link, r=jyn514 Use relative path for local links to primitives Else, links to `char::foo` would point into `/path/to/src/libcore/std/primitive.char.html#method.foo`. Split out from rust-lang#73804.
Actually, it looks like #74061 already includes everything I've got here, and is more complete. Let's close this one in favor of that. |
When I was reading the String documentation, I tried to follow the "pattern" link below
trim_end_matches
and found myself on a 404 page. It looks like the url I was visiting and the url for the pattern docs were as follows:I believe this change points the link to the right location, but I'm not entirely sure how to check.