From 230df0ec0c91cbbd75a42cf4082459b74b68ebce Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 29 Apr 2020 18:02:05 -0700 Subject: [PATCH] Upgrade to Rust 1.43.0 (#9754) --- ci/docker-rust-nightly/Dockerfile | 2 +- ci/docker-rust/Dockerfile | 2 +- ci/rust-version.sh | 26 ++++++++++++++++---------- ci/test-bench.sh | 2 +- core/src/validator.rs | 2 +- logger/src/lib.rs | 2 +- runtime/src/accounts_db.rs | 8 ++++---- 7 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ci/docker-rust-nightly/Dockerfile b/ci/docker-rust-nightly/Dockerfile index 1ddc1f225e..889ebdccab 100644 --- a/ci/docker-rust-nightly/Dockerfile +++ b/ci/docker-rust-nightly/Dockerfile @@ -1,4 +1,4 @@ -FROM solanalabs/rust:1.42.0 +FROM solanalabs/rust:1.43.0 ARG date RUN set -x \ diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile index 1bc31b5dad..3514cef208 100644 --- a/ci/docker-rust/Dockerfile +++ b/ci/docker-rust/Dockerfile @@ -1,6 +1,6 @@ # Note: when the rust version is changed also modify # ci/rust-version.sh to pick up the new image tag -FROM rust:1.42.0 +FROM rust:1.43.0 # Add Google Protocol Buffers for Libra's metrics library. ENV PROTOC_VERSION 3.8.0 diff --git a/ci/rust-version.sh b/ci/rust-version.sh index f338a340a6..9141d8507b 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -1,28 +1,30 @@ # # This file maintains the rust versions for use by CI. # -# Build with stable rust, updating the stable toolchain if necessary: -# $ source ci/rust-version.sh stable -# $ cargo +"$rust_stable" build -# -# Build with nightly rust, updating the nightly toolchain if necessary: -# $ source ci/rust-version.sh nightly -# $ cargo +"$rust_nightly" build -# # Obtain the environment variables without any automatic toolchain updating: # $ source ci/rust-version.sh # +# Obtain the environment variables updating both stable and nightly, only stable, or +# only nightly: +# $ source ci/rust-version.sh all +# $ source ci/rust-version.sh stable +# $ source ci/rust-version.sh nightly + +# Then to build with either stable or nightly: +# $ cargo +"$rust_stable" build +# $ cargo +"$rust_nightly" build +# if [[ -n $RUST_STABLE_VERSION ]]; then stable_version="$RUST_STABLE_VERSION" else - stable_version=1.42.0 + stable_version=1.43.0 fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else - nightly_version=2020-03-12 + nightly_version=2020-04-23 fi @@ -51,6 +53,10 @@ export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version" nightly) rustup_install "$rust_nightly" ;; + all) + rustup_install "$rust_stable" + rustup_install "$rust_nightly" + ;; *) echo "Note: ignoring unknown argument: $1" ;; diff --git a/ci/test-bench.sh b/ci/test-bench.sh index 2acb09fd00..5312bac9fa 100755 --- a/ci/test-bench.sh +++ b/ci/test-bench.sh @@ -25,7 +25,7 @@ source ci/_ source ci/upload-ci-artifact.sh eval "$(ci/channel-info.sh)" -source ci/rust-version.sh nightly +source ci/rust-version.sh all set -o pipefail export RUST_BACKTRACE=1 diff --git a/core/src/validator.rs b/core/src/validator.rs index feb1ada18f..8bf9d7182b 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -388,7 +388,7 @@ impl Validator { "New shred signal for the TVU should be the same as the clear bank signal." ); - let vote_tracker = Arc::new({ VoteTracker::new(bank_forks.read().unwrap().root_bank()) }); + let vote_tracker = Arc::new(VoteTracker::new(bank_forks.read().unwrap().root_bank())); let (retransmit_slots_sender, retransmit_slots_receiver) = unbounded(); let tvu = Tvu::new( diff --git a/logger/src/lib.rs b/logger/src/lib.rs index 0fcb724eea..2c456fd292 100644 --- a/logger/src/lib.rs +++ b/logger/src/lib.rs @@ -5,7 +5,7 @@ use std::sync::{Arc, RwLock}; lazy_static! { static ref LOGGER: Arc> = - { Arc::new(RwLock::new(env_logger::Logger::from_default_env())) }; + Arc::new(RwLock::new(env_logger::Logger::from_default_env())); } struct LoggerShim {} diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index c3027b22b2..57e9b1d18f 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -61,7 +61,7 @@ pub const DEFAULT_NUM_DIRS: u32 = 4; lazy_static! { // FROZEN_ACCOUNT_PANIC is used to signal local_cluster that an AccountsDB panic has occurred, // as |cargo test| cannot observe panics in other threads - pub static ref FROZEN_ACCOUNT_PANIC: Arc = { Arc::new(AtomicBool::new(false)) }; + pub static ref FROZEN_ACCOUNT_PANIC: Arc = Arc::new(AtomicBool::new(false)); } #[derive(Debug, Default)] @@ -3795,7 +3795,7 @@ pub mod tests { assert_eq!( vec![None, None, None], (0..3) - .map({ |_| accounts.next_shrink_slot() }) + .map(|_| accounts.next_shrink_slot()) .collect::>() ); @@ -3804,7 +3804,7 @@ pub mod tests { assert_eq!( vec![Some(7), Some(7), Some(7)], (0..3) - .map({ |_| accounts.next_shrink_slot() }) + .map(|_| accounts.next_shrink_slot()) .collect::>() ); @@ -3812,7 +3812,7 @@ pub mod tests { accounts.add_root(current_slot); let slots = (0..6) - .map({ |_| accounts.next_shrink_slot() }) + .map(|_| accounts.next_shrink_slot()) .collect::>(); // Because the origin of this data is HashMap (not BTreeMap), key order is arbitrary per cycle.