Skip to content

Commit 57a6c93

Browse files
committed
Cleanup ensure_if_default to not require Option output
1 parent 65c3597 commit 57a6c93

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
@@ -1548,7 +1548,7 @@ impl Step for Extended {
15481548
let mut built_tools = HashSet::new();
15491549
macro_rules! add_component {
15501550
($name:expr => $step:expr) => {
1551-
if let Some(tarball) = builder.ensure_if_default($step, Kind::Dist) {
1551+
if let Some(Some(tarball)) = builder.ensure_if_default($step, Kind::Dist) {
15521552
tarballs.push(tarball);
15531553
built_tools.insert($name);
15541554
}

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
@@ -1705,11 +1705,11 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s
17051705
/// Ensure that a given step is built *only if it's supposed to be built by default*, returning
17061706
/// its output. This will cache the step, so it's safe (and good!) to call this as often as
17071707
/// needed to ensure that all dependencies are build.
1708-
pub(crate) fn ensure_if_default<T, S: Step<Output = Option<T>>>(
1708+
pub(crate) fn ensure_if_default<T, S: Step<Output = T>>(
17091709
&'a self,
17101710
step: S,
17111711
kind: Kind,
1712-
) -> S::Output {
1712+
) -> Option<S::Output> {
17131713
let desc = StepDescription::from::<S>(kind);
17141714
let should_run = (desc.should_run)(ShouldRun::new(self, desc.kind));
17151715

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

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

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

0 commit comments

Comments
 (0)