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

cargo doc -Zbuild-std doesn't generate links to the standard library #88

Open
jyn514 opened this issue Jun 2, 2023 · 5 comments
Open

Comments

@jyn514
Copy link
Member

jyn514 commented Jun 2, 2023

See for example https://docs.rs/gba/latest/gba/macro.include_aligned_bytes.html.

@Nemo157 and I think this is because std doesn't have html_root_url set and cargo doesn't treat it as coming from crates.io, so -Zrustdoc-map doesn't help. The fix is for cargo to internally pass -Zcrate-attr=doc(html_root_url=https://doc.rust-lang.org/stable/std), like bootstrap does: https://github.com/rust-lang/rust/blob/871b5952023139738f72eba235063575062bc2e9/src/bootstrap/compile.rs#L416-L419

@ehuss
Copy link
Contributor

ehuss commented Jun 2, 2023

Just curious, which of these behaviors would you expect to be the default, and which would you like the option of using?

  1. Link to https://doc.rust-lang.org/<channel>/
  2. Link to local docs installed via rustup
  3. Generate documentation for std in the local target folder and link to it there (like it was any other dependency)

@Lokathor
Copy link

Lokathor commented Jun 2, 2023

I'd expect docs.rs to use (1), I'm not sure about local docs. Maybe I'd still expect (1) by default?

@jyn514
Copy link
Member Author

jyn514 commented Jun 3, 2023

Hmm. docs.rs uses --no-deps, so it needs 1 to at least be an option - i would be ok with manually passing --extern-html-root-url there if you don't want to support it in cargo.

I'd expect 3. to be the behavior without --no-deps. I think with no-deps I'd expect 2. to be the default with a fallback to 1. if rust-docs isn't installed.

@Lokathor
Copy link

Lokathor commented Jun 3, 2023

Since this is specifically for build-std, rust-src will always be installed (edit: or if someone is silly enough to try and doc a crate they couldn't build on that same machine, it seems fine to just error out)

@Nemo157
Copy link
Member

Nemo157 commented Jun 3, 2023

I think with no-deps I'd expect 2. to be the default with a fallback to 1. if rust-src isn't installed.

I assume this was meant to be rust-docs not rust-src.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants