Skip to content

Commit c030749

Browse files
committed
fix: pass --extern-html-root-takes-precedence in addition to --extern-html-root-url on rustdoc invocation
1 parent 80abaf4 commit c030749

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/cargo/core/compiler/rustdoc.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,16 @@ pub fn add_root_urls(
228228
}
229229
Some(RustdocExternMode::Url(s)) => Some(s.to_string()),
230230
};
231+
232+
if matches!(std_url, Some(_))
233+
|| map
234+
.registries
235+
.iter()
236+
.any(|(registory, _)| registory != CRATES_IO_REGISTRY)
237+
{
238+
rustdoc.arg("--extern-html-root-takes-precedence");
239+
}
240+
231241
if let Some(url) = std_url {
232242
for name in &["std", "core", "alloc", "proc_macro"] {
233243
rustdoc.arg("--extern-html-root-url");

tests/testsuite/rustdoc_extern_html.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ fn simple() {
6060
assert!(myfun.contains(r#"href="https://docs.rs/bar/1.0.0/bar/struct.Straw.html""#));
6161
}
6262

63-
#[ignore = "Broken, temporarily disabled until https://github.com/rust-lang/rust/pull/82776 is resolved."]
64-
#[cargo_test]
65-
// #[cargo_test(nightly, reason = "--extern-html-root-url is unstable")]
63+
#[cargo_test(nightly, reason = "--extern-html-root-url is unstable")]
6664
fn std_docs() {
6765
// Mapping std docs somewhere else.
6866
// For local developers, skip this test if docs aren't installed.

0 commit comments

Comments
 (0)