Skip to content

Commit 7b4ddf7

Browse files
authored
Update to Rust version 1.85 (#3622)
## Motivation The code was previously stuck with Rust version 1.81 because newer versions would cause applications to fail to load (#3196). However, with that issue fixed ([PR #1](linera-io/parity-wasm#1)), it is now possible to update the code to the latest stable Rust version. ## Proposal Update the minimum supported Rust version to 1.85, and apply the suggestions from the newer versions of the compiler and the linter. Also update the nightly version used in CI to a newer version so that it's not so far behind the stable version to the point it causes compilation issues. ## Test Plan CI should catch any regressions. ## Release Plan - These changes follow the usual release cycle, because it's backwards compatible and allows downstream dependencies to use newer Rust versions. ## Links - Future work: update to use the new Rust 2024 edition. - Closes #3196 - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent fe01666 commit 7b4ddf7

File tree

56 files changed

+183
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+183
-169
lines changed

Cargo.lock

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ wasm-bindgen = "0.2.92"
204204
wasm-bindgen-futures = "0.4.42"
205205
wasm-bindgen-test = "0.3.42"
206206
wasm-encoder = "0.24.1"
207-
wasm-instrument = "0.4.0"
207+
wasm-instrument = { package = "linera-wasm-instrument", version = "0.4.0-linera.1" }
208208
wasm_thread = "0.3.0"
209-
wasmer = { package = "linera-wasmer", version = "4.4.0-linera.6", default-features = false }
210-
wasmer-compiler-singlepass = { package = "linera-wasmer-compiler-singlepass", version = "4.4.0-linera.6", default-features = false, features = [
209+
wasmer = { package = "linera-wasmer", version = "4.4.0-linera.7", default-features = false }
210+
wasmer-compiler-singlepass = { package = "linera-wasmer-compiler-singlepass", version = "4.4.0-linera.7", default-features = false, features = [
211211
"std",
212212
"unwind",
213213
"avx",

examples/Cargo.lock

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/crowd-funding/tests/campaign_lifecycle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async fn collect_pledges() {
4848
let (token_id, backers) = fungible::create_with_accounts(
4949
&validator,
5050
fungible_module_id,
51-
iter::repeat(initial_amount).take(3),
51+
iter::repeat_n(initial_amount, 3),
5252
)
5353
.await;
5454

@@ -150,7 +150,7 @@ async fn cancel_successful_campaign() {
150150
let (token_id, backers) = fungible::create_with_accounts(
151151
&validator,
152152
fungible_module_id,
153-
iter::repeat(initial_amount).take(3),
153+
iter::repeat_n(initial_amount, 3),
154154
)
155155
.await;
156156

linera-base/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub fn parse_version_message(message: &str) -> String {
114114
.unwrap_or_default()
115115
.trim()
116116
.split(' ')
117-
.last()
117+
.next_back()
118118
.expect("splitting strings gives non-empty lists")
119119
.to_string()
120120
}

linera-base/src/crypto/ed25519.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl WitStore for Ed25519PublicKey {
276276
}
277277
}
278278

279-
impl<'de> BcsHashable<'de> for Ed25519PublicKey {}
279+
impl BcsHashable<'_> for Ed25519PublicKey {}
280280

281281
impl Ed25519Signature {
282282
/// Computes a signature.
@@ -436,7 +436,7 @@ mod tests {
436436
#[derive(Debug, Serialize, Deserialize)]
437437
struct Foo(String);
438438

439-
impl<'de> BcsSignable<'de> for Foo {}
439+
impl BcsSignable<'_> for Foo {}
440440

441441
let key1 = Ed25519SecretKey::generate();
442442
let addr1 = key1.public();

linera-base/src/crypto/hash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl io::Write for Keccak256Ext {
7575
#[cfg_attr(with_testing, derive(Default))]
7676
pub struct CryptoHashVec(pub Vec<CryptoHash>);
7777

78-
impl<'de> BcsHashable<'de> for CryptoHashVec {}
78+
impl BcsHashable<'_> for CryptoHashVec {}
7979

8080
impl Serialize for CryptoHash {
8181
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
@@ -145,7 +145,7 @@ impl From<CryptoHash> for [u64; 4] {
145145
impl fmt::Display for CryptoHash {
146146
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
147147
let prec = f.precision().unwrap_or(self.0.len() * 2);
148-
hex::encode(&self.0[..((prec + 1) / 2)]).fmt(f)
148+
hex::encode(&self.0[..prec.div_ceil(2)]).fmt(f)
149149
}
150150
}
151151

linera-base/src/crypto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl TestString {
344344
}
345345

346346
#[cfg(with_testing)]
347-
impl<'de> BcsSignable<'de> for TestString {}
347+
impl BcsSignable<'_> for TestString {}
348348

349349
/// Reads the `bytes` as four little-endian unsigned 64-bit integers and returns them.
350350
pub(crate) fn le_bytes_to_u64_array(bytes: &[u8]) -> [u64; 4] {

linera-base/src/crypto/secp256k1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl fmt::Debug for Secp256k1PublicKey {
192192
}
193193
}
194194

195-
impl<'de> BcsHashable<'de> for Secp256k1PublicKey {}
195+
impl BcsHashable<'_> for Secp256k1PublicKey {}
196196

197197
impl WitType for Secp256k1PublicKey {
198198
const SIZE: u32 = <(u64, u64, u64, u64, u8) as WitType>::SIZE;
@@ -501,7 +501,7 @@ mod tests {
501501
#[derive(Debug, Serialize, Deserialize)]
502502
struct Foo(String);
503503

504-
impl<'de> BcsSignable<'de> for Foo {}
504+
impl BcsSignable<'_> for Foo {}
505505

506506
let keypair1 = Secp256k1KeyPair::generate();
507507
let keypair2 = Secp256k1KeyPair::generate();

0 commit comments

Comments
 (0)