about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-08-31 17:39:28 +0000
committerbors <bors@rust-lang.org>2018-08-31 17:39:28 +0000
commitaaa170bebe31d03e2eea14e8cb06dc2e8891216b (patch)
tree69401f21bce6a0136c59a6df85f20da6f29e700a /src/test
parent163adf2860d0a5d9eff0e401e314de9383ff56a1 (diff)
parentfcb54f674ab5f86b72ef97178a3df255f1ef4783 (diff)
downloadrust-aaa170bebe31d03e2eea14e8cb06dc2e8891216b.tar.gz
rust-aaa170bebe31d03e2eea14e8cb06dc2e8891216b.zip
Auto merge of #51384 - QuietMisdreavus:extern-version, r=GuillaumeGomez
rustdoc: add flag to control the html_root_url of dependencies

The `--extern-html-root-url` flag in this PR allows one to override links to crates whose docs are not already available locally in the doc bundle. Docs.rs currently uses a version of this to make sure links to other crates go into that crate's docs.rs page. See the included test for intended use, but the idea is as follows:

Calling rustdoc with `--extern-html-root-url crate=https://some-url.com` will cause rustdoc to override links that point to that crate to instead be replaced with a link rooted at `https://some-url.com/`. (e.g. for docs.rs this would be `https://docs.rs/crate/0.1.0` or the like.) Cheekily, rustup could use these options to redirect links to std/core/etc to instead point to locally-downloaded docs, if it so desired.

Fixes https://github.com/rust-lang/rust/issues/19603
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/extern-html-root-url.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/rustdoc/extern-html-root-url.rs b/src/test/rustdoc/extern-html-root-url.rs
new file mode 100644
index 00000000000..c8a13bec9d3
--- /dev/null
+++ b/src/test/rustdoc/extern-html-root-url.rs
@@ -0,0 +1,18 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+// compile-flags:-Z unstable-options --extern-html-root-url core=https://example.com/core/0.1.0
+
+// @has extern_html_root_url/index.html
+// @has - '//a/@href' 'https://example.com/core/0.1.0/core/iter/index.html'
+#[doc(no_inline)]
+pub use std::iter;