From 92b0d35cd93eab466546a104ccff718a6a793d86 Mon Sep 17 00:00:00 2001 From: Jason Greathouse Date: Fri, 13 Dec 2024 17:27:01 -0600 Subject: [PATCH] Upgrade rust to 1.77.0 nightly - 2024-02-01 (#4022) * upgrade rust to 1.77.0 nightly - 2024-02-01 --- .config/nextest.toml | 2 ++ .github/workflows/ci.yml | 1 + connection/src/sync.rs | 3 +++ fog/distribution/src/main.rs | 2 +- fog/test_infra/src/db_tests.rs | 4 ++-- fog/types/src/common.rs | 4 +--- fog/view/enclave/impl/src/types.rs | 2 +- mobilecoind-json/src/data_types.rs | 7 +++---- rust-toolchain | 2 +- util/build/enclave/src/lib.rs | 14 ++++++++------ util/repr-bytes/src/lib.rs | 4 ++++ util/u64-ratio/src/lib.rs | 3 +++ 12 files changed, 30 insertions(+), 18 deletions(-) diff --git a/.config/nextest.toml b/.config/nextest.toml index 6d4eb63e08..a825c6cc3c 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -7,6 +7,8 @@ failure-output = "immediate-final" status-level = "slow" # Add retires for flaky tests retries = { backoff = "exponential", count = 3, delay = "5s" } +# Limit threads to a "large" gha container max +test-threads = 22 [profile.ci.junit] # Output a JUnit report under `target/nextest/ci/junit.xml`. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 764fd706c2..168dd36f6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ on: env: CARGO_TERM_COLOR: always + CARGO_BUILD_JOBS: 22 RUST_BACKTRACE: 1 MC_TELEMETRY: 0 SKIP_SLOW_TESTS: 1 diff --git a/connection/src/sync.rs b/connection/src/sync.rs index 311ddc668f..40dff2535b 100644 --- a/connection/src/sync.rs +++ b/connection/src/sync.rs @@ -101,6 +101,9 @@ impl Ord for SyncConnection { } } +// this check maybe be buggy and fixed in later versions: +// https://github.com/rust-lang/rust-clippy/issues/12154 +#[allow(clippy::unconditional_recursion)] impl PartialEq for SyncConnection { fn eq(&self, other: &Self) -> bool { let self_g = self.read(); diff --git a/fog/distribution/src/main.rs b/fog/distribution/src/main.rs index 3100661ce0..3fc6547404 100755 --- a/fog/distribution/src/main.rs +++ b/fog/distribution/src/main.rs @@ -66,7 +66,7 @@ use tempfile::tempdir; thread_local! { /// global variable storing connections to the consensus network - static CONNS: RefCell>>>> = RefCell::new(None); + static CONNS: RefCell>>>> = const { RefCell::new(None) }; } fn set_conns(config: &Config, logger: &Logger) { diff --git a/fog/test_infra/src/db_tests.rs b/fog/test_infra/src/db_tests.rs index d750533a0e..aedb7e8197 100644 --- a/fog/test_infra/src/db_tests.rs +++ b/fog/test_infra/src/db_tests.rs @@ -252,7 +252,7 @@ pub fn recovery_db_rng_records_decommissioning( .unwrap(); // Test that user has rng record event now - let test_rows0 = vec![kex_rng_pubkey1]; + let test_rows0 = [kex_rng_pubkey1]; let (user_events, next_start_from_user_event_id) = db.search_user_events(0).unwrap(); let rng_records: Vec = user_events @@ -292,7 +292,7 @@ pub fn recovery_db_rng_records_decommissioning( // Check that if starting at next_start_from_user_event_id we only see the // second rng - let test_rows1 = vec![kex_rng_pubkey2]; + let test_rows1 = [kex_rng_pubkey2]; let (user_events, _next_start_from_user_event_id) = db .search_user_events(next_start_from_user_event_id) diff --git a/fog/types/src/common.rs b/fog/types/src/common.rs index 84b6d0b037..f9aa1acc07 100644 --- a/fog/types/src/common.rs +++ b/fog/types/src/common.rs @@ -91,9 +91,7 @@ impl BlockRange { ) -> Option<(usize, BlockRange)> { let mut ranges = ranges.into_iter(); let first = ranges.next().cloned(); - let Some(mut merged_range) = first else { - return None; - }; + let mut merged_range = first?; let mut index = 0; for range in ranges { diff --git a/fog/view/enclave/impl/src/types.rs b/fog/view/enclave/impl/src/types.rs index ce572b4e0b..38434433b1 100644 --- a/fog/view/enclave/impl/src/types.rs +++ b/fog/view/enclave/impl/src/types.rs @@ -425,7 +425,7 @@ mod shared_data_tests { const STORE_COUNT: usize = 4; let mut decrypted_query_responses = Vec::with_capacity(STORE_COUNT); - let missed_block_ranges = vec![ + let missed_block_ranges = [ BlockRange::new(0, 1), BlockRange::new(10, 12), BlockRange::new(33, 100), diff --git a/mobilecoind-json/src/data_types.rs b/mobilecoind-json/src/data_types.rs index 7e063cba02..bcd98287c5 100644 --- a/mobilecoind-json/src/data_types.rs +++ b/mobilecoind-json/src/data_types.rs @@ -1515,10 +1515,9 @@ mod test { outlay.set_value(1234); let outlay_index_to_tx_out_index = HashMap::from_iter(vec![(0, 0)]); - let outlay_confirmation_numbers = - vec![mc_transaction_extra::TxOutConfirmationNumber::from( - [0u8; 32], - )]; + let outlay_confirmation_numbers = [mc_transaction_extra::TxOutConfirmationNumber::from( + [0u8; 32], + )]; // Make proto TxProposal let mut proto_proposal = api::TxProposal::new(); diff --git a/rust-toolchain b/rust-toolchain index 8fda2d92fd..b0a10d73c9 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2023-12-21" +channel = "nightly-2024-02-03" diff --git a/util/build/enclave/src/lib.rs b/util/build/enclave/src/lib.rs index 44cfa044f9..89302463b0 100644 --- a/util/build/enclave/src/lib.rs +++ b/util/build/enclave/src/lib.rs @@ -653,12 +653,14 @@ impl Builder { let staticlib_target_dir = &self.target_dir; - // e.g. "mc_foo_enclave_trusted" - let staticlib_crate_name = self.staticlib.workspace_members[0] - .repr - .split_whitespace() - .next() - .ok_or(Error::TrustedCrateName)?; + // The workspace_members IDs have changed to this format: + // path+file:///tmp/mobilenode/consensus/enclave/trusted#mc_consensus_enclave_trusted@6.1 + // We want to capture everything after the last '#' and before the '@' + let workspace_id = self.staticlib.workspace_members[0].repr.clone(); + let workspace_id_parts: Vec<&str> = workspace_id.split('#').collect(); + let workspace_name = workspace_id_parts[1]; + let workspace_name_parts: Vec<&str> = workspace_name.split('@').collect(); + let staticlib_crate_name = workspace_name_parts[0]; // "target/name//libmc_foo_enclave_trusted.a" -- not xplatform, but // neither is our use of SGX, so meh. diff --git a/util/repr-bytes/src/lib.rs b/util/repr-bytes/src/lib.rs index 9633ab2ccb..f10adfb2eb 100644 --- a/util/repr-bytes/src/lib.rs +++ b/util/repr-bytes/src/lib.rs @@ -396,11 +396,15 @@ macro_rules! derive_core_cmp_from_as_ref { } } + // this check maybe be buggy and fixed in later versions: + // https://github.com/rust-lang/rust-clippy/issues/12154 + #[allow(clippy::unconditional_recursion)] impl PartialEq for $mytype { fn eq(&self, other: &Self) -> bool { >::as_ref(self).eq(>::as_ref(other)) } } + impl Eq for $mytype {} impl ::core::hash::Hash for $mytype { diff --git a/util/u64-ratio/src/lib.rs b/util/u64-ratio/src/lib.rs index 1751335829..53252746d3 100644 --- a/util/u64-ratio/src/lib.rs +++ b/util/u64-ratio/src/lib.rs @@ -52,6 +52,9 @@ impl U64Ratio { } } +// this check maybe be buggy and fixed in later versions: +// https://github.com/rust-lang/rust-clippy/issues/12154 +#[allow(clippy::unconditional_recursion)] impl PartialEq for U64Ratio { #[inline] fn eq(&self, other: &Self) -> bool {