Skip to content

Commit 8f97b94

Browse files
committed
bootstrap: don't complain about linkcheck if it is excluded
We don't need to complain to the user about linkcheck having different hosts and targets when it is already excluded. This can be achieved by moving the check to when the step is run instead of in should_run.
1 parent 7b6fc5a commit 8f97b94

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/bootstrap/test.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ impl Step for Linkcheck {
108108
/// documentation to ensure we don't have a bunch of dead ones.
109109
fn run(self, builder: &Builder<'_>) {
110110
let host = self.host;
111+
let hosts = &builder.hosts;
112+
let targets = &builder.targets;
113+
114+
// if we have different hosts and targets, some things may be built for
115+
// the host (e.g. rustc) and others for the target (e.g. std). The
116+
// documentation built for each will contain broken links to
117+
// docs built for the other platform (e.g. rustc linking to cargo)
118+
if (hosts != targets) && !hosts.is_empty() && !targets.is_empty() {
119+
panic!(
120+
"Linkcheck currently does not support builds with different hosts and targets.
121+
You can skip linkcheck with --exclude src/tools/linkchecker"
122+
);
123+
}
111124

112125
builder.info(&format!("Linkcheck ({})", host));
113126

@@ -123,19 +136,6 @@ impl Step for Linkcheck {
123136
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
124137
let builder = run.builder;
125138
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-
}
139139
run.default_condition(builder.config.docs)
140140
}
141141

0 commit comments

Comments
 (0)