Skip to content

Commit e68c93b

Browse files
committed
Remove compiler_for from dist::Extended
1 parent 887831f commit e68c93b

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,10 +1599,10 @@ impl Step for Rustfmt {
15991599
}
16001600
}
16011601

1602+
/// Extended archive that contains the compiler, standard library and a bunch of tools.
16021603
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
16031604
pub struct Extended {
1604-
stage: u32,
1605-
host: TargetSelection,
1605+
build_compiler: Compiler,
16061606
target: TargetSelection,
16071607
}
16081608

@@ -1618,19 +1618,17 @@ impl Step for Extended {
16181618

16191619
fn make_run(run: RunConfig<'_>) {
16201620
run.builder.ensure(Extended {
1621-
stage: run.builder.top_stage,
1622-
host: run.builder.config.host_target,
1621+
build_compiler: run
1622+
.builder
1623+
.compiler(run.builder.top_stage - 1, run.builder.host_target),
16231624
target: run.target,
16241625
});
16251626
}
16261627

16271628
/// Creates a combined installer for the specified target in the provided stage.
16281629
fn run(self, builder: &Builder<'_>) {
16291630
let target = self.target;
1630-
let stage = self.stage;
1631-
let compiler = builder.compiler_for(self.stage, self.host, self.target);
1632-
1633-
builder.info(&format!("Dist extended stage{} ({})", compiler.stage, target));
1631+
builder.info(&format!("Dist extended stage{} ({target})", builder.top_stage));
16341632

16351633
let mut tarballs = Vec::new();
16361634
let mut built_tools = HashSet::new();
@@ -1643,38 +1641,38 @@ impl Step for Extended {
16431641
};
16441642
}
16451643

1646-
let target_compiler = builder.compiler(stage, target);
1644+
let rustc_private_compilers =
1645+
RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, target);
1646+
let build_compiler = rustc_private_compilers.build_compiler();
1647+
let target_compiler = rustc_private_compilers.target_compiler();
1648+
16471649
// When rust-std package split from rustc, we needed to ensure that during
16481650
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
16491651
// the std files during uninstall. To do this ensure that rustc comes
16501652
// before rust-std in the list below.
16511653
tarballs.push(builder.ensure(Rustc { target_compiler }));
1652-
tarballs
1653-
.push(builder.ensure(Std { build_compiler: compiler, target }).expect("missing std"));
1654+
tarballs.push(builder.ensure(Std { build_compiler, target }).expect("missing std"));
16541655

16551656
if target.is_windows_gnu() {
16561657
tarballs.push(builder.ensure(Mingw { target }).expect("missing mingw"));
16571658
}
16581659

1659-
let rustc_private_compilers =
1660-
RustcPrivateCompilers::from_build_compiler(builder, compiler, target);
1661-
16621660
add_component!("rust-docs" => Docs { host: target });
16631661
// Std stage N is documented with compiler stage N
16641662
add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target });
1665-
add_component!("cargo" => Cargo { build_compiler: compiler, target });
1663+
add_component!("cargo" => Cargo { build_compiler, target });
16661664
add_component!("rustfmt" => Rustfmt { compilers: rustc_private_compilers, target });
16671665
add_component!("rust-analyzer" => RustAnalyzer { compilers: rustc_private_compilers, target });
16681666
add_component!("llvm-components" => LlvmTools { target });
16691667
add_component!("clippy" => Clippy { compilers: rustc_private_compilers, target });
16701668
add_component!("miri" => Miri { compilers: rustc_private_compilers, target });
1671-
add_component!("analysis" => Analysis { build_compiler: compiler, target });
1669+
add_component!("analysis" => Analysis { build_compiler, target });
16721670
add_component!("rustc-codegen-cranelift" => CraneliftCodegenBackend {
16731671
compilers: rustc_private_compilers,
16741672
target
16751673
});
16761674
add_component!("llvm-bitcode-linker" => LlvmBitcodeLinker {
1677-
build_compiler: compiler,
1675+
build_compiler,
16781676
target
16791677
});
16801678

@@ -2140,6 +2138,10 @@ impl Step for Extended {
21402138
}
21412139
}
21422140
}
2141+
2142+
fn metadata(&self) -> Option<StepMetadata> {
2143+
Some(StepMetadata::dist("extended", self.target).built_by(self.build_compiler))
2144+
}
21432145
}
21442146

21452147
fn add_env(

src/bootstrap/src/core/builder/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,7 @@ mod snapshot {
12131213
[build] rustc 1 <host> -> miri 2 <host>
12141214
[build] rustc 1 <host> -> cargo-miri 2 <host>
12151215
[dist] rustc 1 <host> -> miri 2 <host>
1216+
[dist] rustc 1 <host> -> extended 2 <host>
12161217
");
12171218
}
12181219

@@ -1549,6 +1550,7 @@ mod snapshot {
15491550
[dist] rustc 1 <host> -> miri 2 <target1>
15501551
[build] rustc 1 <host> -> LlvmBitcodeLinker 2 <target1>
15511552
[doc] rustc 2 <target1> -> std 2 <target1> crates=[]
1553+
[dist] rustc 1 <host> -> extended 2 <target1>
15521554
");
15531555
}
15541556

0 commit comments

Comments
 (0)