From 36589700cc3d70f37928be47369ee2cd95956ed3 Mon Sep 17 00:00:00 2001 From: Stephan Boyer Date: Sun, 6 Jul 2025 02:44:41 -0600 Subject: [PATCH] Update Rust to v1.88.0 --- .github/workflows/ci.yml | 12 ++++++------ src/generate_rust.rs | 5 ++--- test_data/types.rs | 5 ++--- toast.yml | 12 ++++++------ 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 576159ec..1fef0a71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,8 +90,8 @@ jobs: # https://github.com/rust-lang/rustup/issues/2441 # # for more information. - rustup toolchain install 1.87.0 --no-self-update # [ref:rust_1.87.0] - rustup default 1.87.0 # [ref:rust_1.87.0] + rustup toolchain install 1.88.0 --no-self-update # [ref:rust_1.88.0] + rustup default 1.88.0 # [ref:rust_1.88.0] # Add the targets. rustup target add x86_64-pc-windows-msvc @@ -131,8 +131,8 @@ jobs: set -euxo pipefail # Install the appropriate version of Rust. - rustup toolchain install 1.87.0 # [ref:rust_1.87.0] - rustup default 1.87.0 # [ref:rust_1.87.0] + rustup toolchain install 1.88.0 # [ref:rust_1.88.0] + rustup default 1.88.0 # [ref:rust_1.88.0] # Add the targets. rustup target add x86_64-apple-darwin @@ -207,8 +207,8 @@ jobs: set -euxo pipefail # Install the appropriate version of Rust. - rustup toolchain install 1.87.0 # [ref:rust_1.87.0] - rustup default 1.87.0 # [ref:rust_1.87.0] + rustup toolchain install 1.88.0 # [ref:rust_1.88.0] + rustup default 1.88.0 # [ref:rust_1.88.0] # Fetch the program version. VERSION="$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" diff --git a/src/generate_rust.rs b/src/generate_rust.rs index e5d76d08..00b12145 100644 --- a/src/generate_rust.rs +++ b/src/generate_rust.rs @@ -140,7 +140,6 @@ pub fn generate( use std::{{ cmp::min, io::{{self, BufRead, Error, ErrorKind, Write}}, - mem::transmute, }}; const MISSING_FIELDS_ERROR_MESSAGE: &str = \"Struct missing one or more required field(s).\"; @@ -156,11 +155,11 @@ pub trait Deserialize: Sized {{ }} fn zigzag_encode(value: i64) -> u64 {{ - unsafe {{ transmute::(value >> 63_u32) ^ transmute::(value << 1_u32) }} + i64::cast_unsigned(value >> 63_u32) ^ i64::cast_unsigned(value << 1_u32) }} fn zigzag_decode(value: u64) -> i64 {{ - unsafe {{ transmute::(value >> 1_u32) ^ -transmute::(value & 1) }} + u64::cast_signed(value >> 1_u32) ^ -u64::cast_signed(value & 1) }} fn varint_size_from_value(value: u64) -> usize {{ diff --git a/test_data/types.rs b/test_data/types.rs index 7d202849..8cc02154 100644 --- a/test_data/types.rs +++ b/test_data/types.rs @@ -4,7 +4,6 @@ use std::{ cmp::min, io::{self, BufRead, Error, ErrorKind, Write}, - mem::transmute, }; const MISSING_FIELDS_ERROR_MESSAGE: &str = "Struct missing one or more required field(s)."; @@ -20,11 +19,11 @@ pub trait Deserialize: Sized { } fn zigzag_encode(value: i64) -> u64 { - unsafe { transmute::(value >> 63_u32) ^ transmute::(value << 1_u32) } + i64::cast_unsigned(value >> 63_u32) ^ i64::cast_unsigned(value << 1_u32) } fn zigzag_decode(value: u64) -> i64 { - unsafe { transmute::(value >> 1_u32) ^ -transmute::(value & 1) } + u64::cast_signed(value >> 1_u32) ^ -u64::cast_signed(value & 1) } fn varint_size_from_value(value: u64) -> usize { diff --git a/toast.yml b/toast.yml index 3868537a..75c9e0ec 100644 --- a/toast.yml +++ b/toast.yml @@ -17,11 +17,11 @@ command_prefix: | cargo-offline () { cargo --frozen --offline "$@"; } # Use this wrapper for formatting code or checking that code is formatted. We use a nightly Rust - # version for the `trailing_comma` formatting option [tag:rust_fmt_nightly_2025-05-17]. The + # version for the `trailing_comma` formatting option [tag:rust_fmt_nightly_2025-07-06]. The # nightly version was chosen as the latest available release with all components present # according to this page: # https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu.html - cargo-fmt () { cargo +nightly-2025-05-17 --frozen --offline fmt --all -- "$@"; } + cargo-fmt () { cargo +nightly-2025-07-06 --frozen --offline fmt --all -- "$@"; } # Load the NVM startup file, if it exists. if [ -f "$HOME/.nvm/nvm.sh" ]; then @@ -75,18 +75,18 @@ tasks: - install_packages - create_user command: | - # Install stable Rust [tag:rust_1.87.0]. + # Install stable Rust [tag:rust_1.88.0]. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ -y \ - --default-toolchain 1.87.0 \ + --default-toolchain 1.88.0 \ --profile minimal \ --component clippy # Add Rust tools to `$PATH`. . "$HOME/.cargo/env" - # Install nightly Rust [ref:rust_fmt_nightly_2025-05-17]. - rustup toolchain install nightly-2025-05-17 --profile minimal --component rustfmt + # Install nightly Rust [ref:rust_fmt_nightly_2025-07-06]. + rustup toolchain install nightly-2025-07-06 --profile minimal --component rustfmt install_node: description: Install Node.js, a JavaScript runtime environment.