Skip to content

Commit b965d55

Browse files
committed
Auto merge of #44605 - alexcrichton:less-rustdoc, r=Mark-Simulacrum
rustbuild: Compile the error-index in stage 2 Right now we comiple rustdoc in stage 2 and the error index in stage 0, which ends up compiling rustdoc twice! To avoid compiling rustdoc twice (which takes awhile) let's just compile it once in stage 2.
2 parents 3a7ab6c + 61e255a commit b965d55

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/bootstrap/tool.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,27 @@ macro_rules! tool {
148148

149149
impl<'a> Builder<'a> {
150150
pub fn tool_exe(&self, tool: Tool) -> PathBuf {
151+
let stage = self.tool_default_stage(tool);
151152
match tool {
152153
$(Tool::$name =>
153154
self.ensure($name {
154-
compiler: self.compiler(0, self.build.build),
155+
compiler: self.compiler(stage, self.build.build),
155156
target: self.build.build,
156157
}),
157158
)+
158159
}
159160
}
161+
162+
pub fn tool_default_stage(&self, tool: Tool) -> u32 {
163+
// Compile the error-index in the top stage as it depends on
164+
// rustdoc, so we want to avoid recompiling rustdoc twice if we
165+
// can. Otherwise compile everything else in stage0 as there's
166+
// no need to rebootstrap everything
167+
match tool {
168+
Tool::ErrorIndex => self.top_stage,
169+
_ => 0,
170+
}
171+
}
160172
}
161173

162174
$(
@@ -436,7 +448,7 @@ impl<'a> Builder<'a> {
436448
/// `host`.
437449
pub fn tool_cmd(&self, tool: Tool) -> Command {
438450
let mut cmd = Command::new(self.tool_exe(tool));
439-
let compiler = self.compiler(0, self.build.build);
451+
let compiler = self.compiler(self.tool_default_stage(tool), self.build.build);
440452
self.prepare_tool_cmd(compiler, &mut cmd);
441453
cmd
442454
}

0 commit comments

Comments
 (0)