Skip to content

Commit

Permalink
bootstrap: don't run linkcheck when crosscompiling
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tblah committed Mar 28, 2021
1 parent 8b40dd1 commit b2a97ff
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/bootstrap/test.rs
Expand Up @@ -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<'_>) {
Expand Down

0 comments on commit b2a97ff

Please sign in to comment.