From f73f71f9bc7fb74f3a5390598d036ead640c5a80 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 26 Jul 2020 20:04:39 -0400 Subject: [PATCH] Add rustup when installing a new toolchain Example build: ``` 2020/07/26 20:02:52 [INFO] rustwide::toolchain: adding component rustfmt for toolchain nightly 2020/07/26 20:02:52 [INFO] rustwide::cmd: running `Command { std: "/home/joshua/src/rust/docs.rs/.rustwide/cargo-home/bin/rustup" "component" "add" "--toolchain" "nightly" "rustfmt", kill_on_drop: false }` 2020/07/26 20:02:53 [INFO] rustwide::cmd: [stderr] info: downloading component 'rustfmt' 2020/07/26 20:02:54 [INFO] rustwide::cmd: [stderr] info: installing component 'rustfmt' ``` This was tested by building `fermium 0.0.11` with the new changes. I have not tested the upgrade behavior, so possibly this shouldn't be merged until I do that. --- src/db/pool.rs | 2 +- src/docbuilder/rustwide_builder.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/db/pool.rs b/src/db/pool.rs index 92eb88011..910c7b1c1 100644 --- a/src/db/pool.rs +++ b/src/db/pool.rs @@ -89,7 +89,7 @@ pub enum PoolError { #[fail(display = "the provided database URL was not valid")] InvalidDatabaseUrl(#[fail(cause)] postgres::Error), - #[fail(display = "failed to create the connection pool")] + #[fail(display = "failed to create the database connection pool")] PoolCreationFailed(#[fail(cause)] r2d2::Error), #[fail(display = "failed to get a database connection")] diff --git a/src/docbuilder/rustwide_builder.rs b/src/docbuilder/rustwide_builder.rs index 332d9f0d9..85bb2c2f3 100644 --- a/src/docbuilder/rustwide_builder.rs +++ b/src/docbuilder/rustwide_builder.rs @@ -166,6 +166,9 @@ impl RustwideBuilder { for target in &targets_to_install { self.toolchain.add_target(&self.workspace, target)?; } + // NOTE: rustup will automatically refuse to update the toolchain + // if `rustfmt` is not available in the newer version + self.toolchain.add_component(&self.workspace, "rustfmt")?; self.rustc_version = self.detect_rustc_version()?; if old_version.as_deref() != Some(&self.rustc_version) {