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

Link for source of is_x86_feature_detected is broken #96506

Closed
hellow554 opened this issue Apr 28, 2022 · 5 comments · Fixed by #131067
Closed

Link for source of is_x86_feature_detected is broken #96506

hellow554 opened this issue Apr 28, 2022 · 5 comments · Fixed by #131067
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@hellow554
Copy link
Contributor

IIRC there is a broken link checker, but somehow it doesn't catch this case:

https://doc.rust-lang.org/std/macro.is_x86_feature_detected.html

grafik

https://doc.rust-lang.org/1.60.0/src/std_detect/detect/arch/x86.rs.html#18-197 which is a 404

@rustbot modify labels: A-docs

@rustbot rustbot added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Apr 28, 2022
@hellow554
Copy link
Contributor Author

Also, all source links of the macros in https://doc.rust-lang.org/nightly/std/arch/index.html are broken as well.

@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 28, 2022
@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Apr 28, 2022

Another reexport bug. :)

EDIT: so in here the problem is that the std_detect crate isn't documented on doc.rust-lang.org. It should redirect to docs.rs.

@jyn514
Copy link
Member

jyn514 commented Feb 13, 2023

I think the right fix is to pass -Zrustdoc-map to cargo when documenting the standard library. We already do that for the compiler docs:

cargo.arg("-Zrustdoc-map");

mentoring instructions: add that same flag to impl Step for doc::Std.

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Feb 13, 2023
@jyn514
Copy link
Member

jyn514 commented Feb 13, 2023

cc #81311, which is one way to fix this in rustdoc, but will result in a worse experience for the source view.

ehuss added a commit to ehuss/reference that referenced this issue Aug 17, 2024
This removes the explicit links to the standard library. In particular,
this makes it nicer to view locally since you can set SPEC_RELATIVE=0 to
make the links work.

There are a bunch of changes to the actual URL because rustdoc resolves
re-exports to link to the original definition instead of the re-export
site. From what I can tell, everything should otherwise be the same.

Not all links were able to be converted due to some limitations in
rustdoc, such as:

- Links to rexports from std_arch don't work due to rust-lang/rust#96506.
- Links to keywords aren't supported.
- Links to trait impls where the trait is not in the prelude doesn't work (they must be in scope).
ehuss added a commit to ehuss/reference that referenced this issue Aug 17, 2024
This removes the explicit links to the standard library. In particular,
this makes it nicer to view locally since you can set SPEC_RELATIVE=0 to
make the links work.

There are a bunch of changes to the actual URL because rustdoc resolves
re-exports to link to the original definition instead of the re-export
site. From what I can tell, everything should otherwise be the same.

Not all links were able to be converted due to some limitations in
rustdoc, such as:

- Links to rexports from std_arch don't work due to rust-lang/rust#96506.
- Links to keywords aren't supported.
- Links to trait impls where the trait is not in the prelude doesn't work (they must be in scope).
@ismailarilik
Copy link
Contributor

I just opened a PR for this issue: #131067
I confirmed that it fixes this issue. One of my concerns is that it is very similar to the closed PR even if I followed the mentoring instructions.

And the other concern is that although this PR fixes the main issue, there is another issue: Macros here seems still not working: https://doc.rust-lang.org/nightly/std/arch/index.html#macros Actually is_x86_feature_detected is working after this PR but others aren't; I think there is some mismatch about generating links between Cargo and docs.rs.

I can investigate this second issue further in this issue or in a new issue but at first I wanna ensure that I am on the right way.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 13, 2024
… r=albertlarsan68

Fix std_detect links

This PR aims to fix this issue: rust-lang#96506

Fixes rust-lang#96506
@bors bors closed this as completed in 48df1ff Oct 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 14, 2024
Rollup merge of rust-lang#131067 - ismailarilik:fix-std-detect-links, r=albertlarsan68

Fix std_detect links

This PR aims to fix this issue: rust-lang#96506

Fixes rust-lang#96506
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants