Skip to content

Commit b1a7f12

Browse files
committed
Download the Cranelift component from rustup if it is requested as a backend
1 parent 265d618 commit b1a7f12

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

collector/src/bin/collector.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ fn main_result() -> anyhow::Result<i32> {
667667
let get_suite = |rustc: &str, id: &str| {
668668
let toolchain = get_local_toolchain(
669669
&[Profile::Opt],
670+
&[CodegenBackend::Llvm],
670671
rustc,
671672
ToolchainConfig::default(),
672673
id,
@@ -723,6 +724,7 @@ fn main_result() -> anyhow::Result<i32> {
723724
let get_toolchain = |rustc: &str, id: &str| {
724725
let toolchain = get_local_toolchain(
725726
&[Profile::Opt],
727+
&[CodegenBackend::Llvm],
726728
rustc,
727729
ToolchainConfig::default(),
728730
id,
@@ -761,6 +763,7 @@ fn main_result() -> anyhow::Result<i32> {
761763

762764
let toolchain = get_local_toolchain(
763765
&profiles,
766+
&backends,
764767
&local.rustc,
765768
*ToolchainConfig::default()
766769
.rustdoc(opts.rustdoc.as_deref())
@@ -960,6 +963,7 @@ fn main_result() -> anyhow::Result<i32> {
960963
|rustc: &str, suffix: &str| -> anyhow::Result<String> {
961964
let toolchain = get_local_toolchain(
962965
profiles,
966+
&[CodegenBackend::Llvm],
963967
rustc,
964968
*ToolchainConfig::default()
965969
.rustdoc(opts.rustdoc.as_deref())
@@ -1085,6 +1089,7 @@ fn get_local_toolchain_for_runtime_benchmarks(
10851089
) -> anyhow::Result<Toolchain> {
10861090
get_local_toolchain(
10871091
&[Profile::Opt],
1092+
&[CodegenBackend::Llvm],
10881093
&local.rustc,
10891094
*ToolchainConfig::default()
10901095
.cargo(local.cargo.as_deref())

collector/src/toolchain.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::compile::benchmark::codegen_backend::CodegenBackend;
12
use crate::compile::benchmark::profile::Profile;
23
use anyhow::{anyhow, Context};
34
use log::debug;
@@ -330,6 +331,7 @@ impl<'a> ToolchainConfig<'a> {
330331
/// for the nightly Cargo via `rustup`.
331332
pub fn get_local_toolchain(
332333
profiles: &[Profile],
334+
codegen_backends: &[CodegenBackend],
333335
rustc: &str,
334336
toolchain_config: ToolchainConfig<'_>,
335337
id_suffix: &str,
@@ -357,8 +359,18 @@ pub fn get_local_toolchain(
357359
anyhow::bail!("rustup-toolchain-install-master is not installed but must be");
358360
}
359361

360-
if !Command::new("rustup-toolchain-install-master")
361-
.arg(toolchain)
362+
let mut additional_components = vec![];
363+
if codegen_backends.contains(&CodegenBackend::Cranelift) {
364+
additional_components.push("rustc-codegen-cranelift");
365+
}
366+
367+
let mut cmd = Command::new("rustup-toolchain-install-master");
368+
cmd.arg(toolchain);
369+
for component in additional_components {
370+
cmd.arg("-c").arg(component);
371+
}
372+
373+
if !cmd
362374
.status()
363375
.context("failed to run `rustup-toolchain-install-master`")?
364376
.success()

0 commit comments

Comments
 (0)