Skip to content

Use cargo's rustdoc-map instead to link to dependencies #1177

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

Closed
Nemo157 opened this issue Nov 11, 2020 · 1 comment · Fixed by #1188
Closed

Use cargo's rustdoc-map instead to link to dependencies #1177

Nemo157 opened this issue Nov 11, 2020 · 1 comment · Fixed by #1188
Labels
A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature

Comments

@Nemo157
Copy link
Member

Nemo157 commented Nov 11, 2020

Currently we're generating --extern-html-root-url flags to pass to rustdoc ourselves:

for dep in &cargo_metadata.root_dependencies() {
rustdoc_flags.push("--extern-html-root-url".to_string());
rustdoc_flags.push(format!(
"{}=https://docs.rs/{}/{}",
dep.name.replace("-", "_"),
dep.name,
dep.version
));
}

This has issues (#1166, #1165).

Cargo has an unstable rustdoc-map feature rust-lang/cargo#8296 intended to allow users to do a similar thing easily via a simple url template. We can likely use this instead of doing it manually.

@jyn514 jyn514 added A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature labels Nov 12, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 22, 2020

This needs cargo to link crates.io to docs.rs automatically before we can use it - right now you have to set a field in .cargo/config, but rustwide removes config before building the crate.

bors added a commit to rust-lang/cargo that referenced this issue Dec 1, 2020
Set docs.rs as the default extern-map for crates.io

Helps address #8296, specifically the bit needed for rust-lang/docs.rs#1177.
r? `@ehuss`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate C-enhancement Category: This is a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants