about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTom Eccles <tom.eccles@codethink.co.uk>2021-02-21 11:19:50 +0000
committerTom Eccles <tom.eccles@codethink.co.uk>2021-03-28 16:50:16 +0100
commitb2a97ff415ca950e49448c3ad766246cf3a48443 (patch)
tree5cc070f5f6c3e80f662738b29fbaf5c58deaa1a0 /src
parent8b40dd1f50db8ed3086ada80d42f9d834723ed58 (diff)
downloadrust-b2a97ff415ca950e49448c3ad766246cf3a48443.tar.gz
rust-b2a97ff415ca950e49448c3ad766246cf3a48443.zip
bootstrap: don't run linkcheck when crosscompiling
When we cross compile, some things (and their documentation) are built
for the host (e.g. rustc), while others (and their documentation) are built
for the target. This generated documentation will have broken links
between documentation for different platforms e.g. between rustc and
cargo.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/test.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 86d940cd733..248c8a5f82b 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -122,7 +122,21 @@ impl Step for Linkcheck {
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         let builder = run.builder;
-        run.path("src/tools/linkchecker").default_condition(builder.config.docs)
+        let run = run.path("src/tools/linkchecker");
+        let hosts = &builder.hosts;
+        let targets = &builder.targets;
+
+        // if we have different hosts and targets, some things may be built for
+        // the host (e.g. rustc) and others for the target (e.g. std). The
+        // documentation built for each will contain broken links to
+        // docs built for the other platform (e.g. rustc linking to cargo)
+        if (hosts != targets) && !hosts.is_empty() && !targets.is_empty() {
+            panic!(
+                "Linkcheck currently does not support builds with different hosts and targets.
+You can skip linkcheck with --exclude src/tools/linkchecker"
+            );
+        }
+        run.default_condition(builder.config.docs)
     }
 
     fn make_run(run: RunConfig<'_>) {