Skip to content

Commit b71573b

Browse files
committed
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.
1 parent f69d954 commit b71573b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/bootstrap/test.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,21 @@ impl Step for Linkcheck {
122122

123123
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
124124
let builder = run.builder;
125-
run.path("src/tools/linkchecker").default_condition(builder.config.docs)
125+
let run = run.path("src/tools/linkchecker");
126+
let hosts = &builder.hosts;
127+
let targets = &builder.targets;
128+
129+
// if we have different hosts and targets, some things may be built for
130+
// the host (e.g. rustc) and others for the target (e.g. std). The
131+
// documentation built for each will contain broken links to
132+
// docs built for the other platform (e.g. rustc linking to cargo)
133+
if (hosts != targets) && !hosts.is_empty() && !targets.is_empty() {
134+
panic!(
135+
"Linkcheck currently does not support builds with different hosts and targets.
136+
You can skip linkcheck with --exclude src/tools/linkchecker"
137+
);
138+
}
139+
run.default_condition(builder.config.docs)
126140
}
127141

128142
fn make_run(run: RunConfig<'_>) {

0 commit comments

Comments
 (0)