Skip to content

Commit ca66698

Browse files
committed
Cleanup ensure_if_default to not require Option output
1 parent d1683e7 commit ca66698

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ impl Step for Extended {
15441544
let mut built_tools = HashSet::new();
15451545
macro_rules! add_component {
15461546
($name:expr => $step:expr) => {
1547-
if let Some(tarball) = builder.ensure_if_default($step, Kind::Dist) {
1547+
if let Some(Some(tarball)) = builder.ensure_if_default($step, Kind::Dist) {
15481548
tarballs.push(tarball);
15491549
built_tools.insert($name);
15501550
}

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,8 @@ pub struct RustAnalyzerProcMacroSrv {
11301130
}
11311131

11321132
impl Step for RustAnalyzerProcMacroSrv {
1133-
type Output = Option<ToolBuildResult>;
1133+
type Output = ToolBuildResult;
1134+
11341135
const DEFAULT: bool = true;
11351136
const ONLY_HOSTS: bool = true;
11361137

@@ -1152,7 +1153,7 @@ impl Step for RustAnalyzerProcMacroSrv {
11521153
});
11531154
}
11541155

1155-
fn run(self, builder: &Builder<'_>) -> Option<ToolBuildResult> {
1156+
fn run(self, builder: &Builder<'_>) -> Self::Output {
11561157
let tool_result = builder.ensure(ToolBuild {
11571158
build_compiler: self.compiler,
11581159
target: self.target,
@@ -1176,7 +1177,7 @@ impl Step for RustAnalyzerProcMacroSrv {
11761177
FileType::Executable,
11771178
);
11781179

1179-
Some(tool_result)
1180+
tool_result
11801181
}
11811182
}
11821183

src/bootstrap/src/core/builder/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,11 +1704,11 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s
17041704
/// Ensure that a given step is built *only if it's supposed to be built by default*, returning
17051705
/// its output. This will cache the step, so it's safe (and good!) to call this as often as
17061706
/// needed to ensure that all dependencies are build.
1707-
pub(crate) fn ensure_if_default<T, S: Step<Output = Option<T>>>(
1707+
pub(crate) fn ensure_if_default<T, S: Step<Output = T>>(
17081708
&'a self,
17091709
step: S,
17101710
kind: Kind,
1711-
) -> S::Output {
1711+
) -> Option<S::Output> {
17121712
let desc = StepDescription::from::<S>(kind);
17131713
let should_run = (desc.should_run)(ShouldRun::new(self, desc.kind));
17141714

@@ -1720,7 +1720,7 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s
17201720
}
17211721

17221722
// Only execute if it's supposed to run as default
1723-
if desc.default && should_run.is_really_default() { self.ensure(step) } else { None }
1723+
if desc.default && should_run.is_really_default() { Some(self.ensure(step)) } else { None }
17241724
}
17251725

17261726
/// Checks if any of the "should_run" paths is in the `Builder` paths.

0 commit comments

Comments
 (0)