diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-08-12 12:39:14 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-08-23 11:00:30 +0200 |
| commit | e7b7d3933254689f0b87eaf01654284169a95f10 (patch) | |
| tree | c8e66702dcece783ccb146f45d9aa040ddc17d77 | |
| parent | 502dc8df56e37477da5249245cb8074b40a4c2ce (diff) | |
| download | rust-e7b7d3933254689f0b87eaf01654284169a95f10.tar.gz rust-e7b7d3933254689f0b87eaf01654284169a95f10.zip | |
Refactor `RustcDev` dist step
| -rw-r--r-- | src/bootstrap/src/core/build_steps/dist.rs | 28 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder/tests.rs | 9 |
2 files changed, 25 insertions, 12 deletions
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 5694688780b..722d79439cb 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -823,8 +823,9 @@ impl Step for Std { /// (Don't confuse this with [`RustDev`], without the `c`!) #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct RustcDev { - pub compiler: Compiler, - pub target: TargetSelection, + /// The compiler that will build rustc which will be shipped in this component. + build_compiler: Compiler, + target: TargetSelection, } impl Step for RustcDev { @@ -838,28 +839,27 @@ impl Step for RustcDev { fn make_run(run: RunConfig<'_>) { run.builder.ensure(RustcDev { - compiler: run.builder.compiler_for( - run.builder.top_stage, - run.builder.config.host_target, - run.target, - ), + // We currently always ship a stage 2 rustc-dev component, so we build it with the + // stage 1 compiler. This might change in the future. + // The precise stage used here is important, so we hard-code it. + build_compiler: run.builder.compiler(1, run.builder.config.host_target), target: run.target, }); } fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { - let compiler = self.compiler; + let build_compiler = self.build_compiler; let target = self.target; - if skip_host_target_lib(builder, compiler) { + if skip_host_target_lib(builder, build_compiler) { return None; } - builder.ensure(compile::Rustc::new(compiler, target)); + // Build the compiler that we will ship + builder.ensure(compile::Rustc::new(build_compiler, target)); let tarball = Tarball::new(builder, "rustc-dev", &target.triple); - let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); - let stamp = build_stamp::librustc_stamp(builder, compiler_to_use, target); + let stamp = build_stamp::librustc_stamp(builder, build_compiler, target); copy_target_libs(builder, target, tarball.image_dir(), &stamp); let src_files = &["Cargo.lock"]; @@ -883,6 +883,10 @@ impl Step for RustcDev { Some(tarball.generate()) } + + fn metadata(&self) -> Option<StepMetadata> { + Some(StepMetadata::dist("rustc-dev", self.target).built_by(self.build_compiler)) + } } #[derive(Debug, Clone, Hash, PartialEq, Eq)] diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 2d4c8fb48db..41fbadc56b1 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1134,6 +1134,7 @@ mod snapshot { [build] rustc 0 <host> -> GenerateCopyright 1 <host> [dist] rustc <host> [dist] rustc 1 <host> -> std 1 <host> + [dist] rustc 1 <host> -> rustc-dev 2 <host> [dist] src <> " ); @@ -1196,6 +1197,7 @@ mod snapshot { [build] rustc 0 <host> -> GenerateCopyright 1 <host> [dist] rustc <host> [dist] rustc 1 <host> -> std 1 <host> + [dist] rustc 1 <host> -> rustc-dev 2 <host> [dist] src <> [build] rustc 1 <host> -> cargo 2 <host> [build] rustc 1 <host> -> rust-analyzer 2 <host> @@ -1276,6 +1278,7 @@ mod snapshot { [dist] rustc 1 <host> -> std 1 <host> [build] rustc 2 <host> -> std 2 <target1> [dist] rustc 2 <host> -> std 2 <target1> + [dist] rustc 1 <host> -> rustc-dev 2 <host> [dist] src <> " ); @@ -1334,6 +1337,8 @@ mod snapshot { [build] rustdoc 2 <target1> [dist] rustc <target1> [dist] rustc 1 <host> -> std 1 <host> + [dist] rustc 1 <host> -> rustc-dev 2 <host> + [dist] rustc 1 <host> -> rustc-dev 2 <target1> [dist] src <> " ); @@ -1413,6 +1418,8 @@ mod snapshot { [dist] rustc <target1> [dist] rustc 1 <host> -> std 1 <host> [dist] rustc 1 <host> -> std 1 <target1> + [dist] rustc 1 <host> -> rustc-dev 2 <host> + [dist] rustc 1 <host> -> rustc-dev 2 <target1> [dist] src <> " ); @@ -1518,6 +1525,7 @@ mod snapshot { [build] rustc 0 <host> -> GenerateCopyright 1 <host> [dist] rustc <target1> [dist] rustc 1 <host> -> std 1 <target1> + [dist] rustc 1 <host> -> rustc-dev 2 <target1> [dist] src <> [build] rustc 1 <host> -> cargo 2 <target1> [build] rustc 1 <host> -> rust-analyzer 2 <target1> @@ -1581,6 +1589,7 @@ mod snapshot { [dist] rustc <host> [dist] rustc 1 <host> -> rustc_codegen_cranelift 2 <host> [dist] rustc 1 <host> -> std 1 <host> + [dist] rustc 1 <host> -> rustc-dev 2 <host> [dist] src <> "); } |
