-
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
Broken parameter links in some of the stdlib documentation #121106
Comments
@rustbot label +A-docs +A-rustdoc-ui +T-rustdoc -needs-triage |
@rustbot claim |
Ignore the above comment. It was a wrong bisection. The regression most likely occurred in PR #116471. I say "most likely" because it was impossible to bisect around this part of the git log because builds kept failing with ICE's. Anyway, the cause of the bug is that in type alias docs links to primitives are being rendered relative to the target type not the alias. For example for This problem seems limited only type aliases. Internally this is how the rendering of the link works:
The end result is that we get a link relative to the type not the alias. |
The fix could either be in What are your thoughts @notriddle since you where the original author? This is the first time I've ventured into rustdoc so any pointers will be helpful. |
I think the second option, generating the link as |
Rollup merge of rust-lang#121490 - gurry:121106-broken-usize-link-in-docs, r=notriddle Rustdoc: include crate name in links for local primitives Fixes rust-lang#121106. This change makes links to primitives easier to use when the path of the page where they will be embedded is not known beforehand such as when we generate impls dynamically from the `register_type_impls` method in `main.js`, which is exactly what is happening in rust-lang#121106. An example to show the effect of this change: earlier, if the current page in `cx.current` inside `primitive_link_fragment()` was `std::simd::prelude::Simd` the generated path would be `../../primitive.<prim>.html`. Now it would be `../../../std/primitive.<prim>.html` instead. A side effect of the change is that local primitive links _everywhere_ will now contain the crate name, even outside of the dynamic situation mentioned above. I'm not sure if there are any major downsides of that other than making the links a bit longer. Ideally I wanted to restrict this behaviour change to only the dynamic cases. We could have achieved that by passing an additional bool arg to `primitive_link_fragment()`, but it felt awkward to do so. Any alternative suggestions are welcome.
…06, r=GuillaumeGomez Add test case for primitive links in alias js Follow up rust-lang#121490 CC rust-lang#121106
…06, r=GuillaumeGomez Add test case for primitive links in alias js Follow up rust-lang#121490 CC rust-lang#121106
…06, r=GuillaumeGomez Add test case for primitive links in alias js Follow up rust-lang#121490 CC rust-lang#121106
…06, r=GuillaumeGomez Add test case for primitive links in alias js Follow up rust-lang#121490 CC rust-lang#121106
…06, r=GuillaumeGomez Add test case for primitive links in alias js Follow up rust-lang#121490 CC rust-lang#121106
Rollup merge of rust-lang#121572 - notriddle:notriddle/test-case-121106, r=GuillaumeGomez Add test case for primitive links in alias js Follow up rust-lang#121490 CC rust-lang#121106
This happens with other parameters. But if you go to the SIMD page through the prelude the link is not broken. Nor is it broken on the portable simd docs. There are other things broken, such as slices on the SIMD page as well. It is also on other SIMD types' documentation pages. I don't know the exact pattern though.
I expected to see this happen:
The link would be to this page: https://doc.rust-lang.org/std/primitive.usize.html
Instead, this happened:
The link is to this page: https://doc.rust-lang.org/primitive.usize.html
Basically it seems to not be inserting the "std" directory in the link.
The text was updated successfully, but these errors were encountered: