From 773a0646ced8bfa113d6560f83d401d81d7d1ed9 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Thu, 8 May 2025 18:37:08 +0000 Subject: [PATCH] fixup ci: unsafe usage on nightly and bump ed25519's MSRV (#753) * ed25519-dalek: bump MSRV to 1.81 base64ct now requires rustc 1.81 * nightly and stable disagree on usage of unsafe ``` error: unnecessary `unsafe` block 492 --> curve25519-dalek/src/backend/vector/avx2/field.rs:479:28 493 | 494 479 | let c9_19: u32x8 = unsafe { 495 | ^^^^^^ unnecessary `unsafe` block ``` This would only happen on nightly. --- .github/workflows/ed25519-dalek.yml | 4 ++-- .github/workflows/workspace.yml | 2 +- curve25519-dalek-derive/README.md | 7 ------- curve25519-dalek/src/backend/vector/avx2/field.rs | 5 +++++ curve25519-dalek/src/backend/vector/ifma/field.rs | 4 ++++ curve25519-dalek/src/backend/vector/packed_simd.rs | 5 +++++ ed25519-dalek/Cargo.toml | 2 +- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ed25519-dalek.yml b/.github/workflows/ed25519-dalek.yml index a49d834..52387c9 100644 --- a/.github/workflows/ed25519-dalek.yml +++ b/.github/workflows/ed25519-dalek.yml @@ -20,7 +20,7 @@ env: jobs: msrv: - name: Current MSRV is 1.60.0 + name: Current MSRV is 1.81.0 runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -29,5 +29,5 @@ jobs: - run: cargo update -Z minimal-versions # Now check that `cargo build` works with respect to the oldest possible # deps and the stated MSRV - - uses: dtolnay/rust-toolchain@1.60.0 + - uses: dtolnay/rust-toolchain@1.81.0 - run: cargo build diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index b8e44dc..5e7fa44 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -85,7 +85,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@1.73.0 + - uses: dtolnay/rust-toolchain@1.81.0 with: components: clippy - run: cargo clippy --target x86_64-unknown-linux-gnu --all-features diff --git a/curve25519-dalek-derive/README.md b/curve25519-dalek-derive/README.md index 69bde71..d577514 100644 --- a/curve25519-dalek-derive/README.md +++ b/curve25519-dalek-derive/README.md @@ -81,14 +81,7 @@ to build out more elaborate abstractions it starts to become painful to use. This crate exposes an `#[unsafe_target_feature]` macro which works just like `#[target_feature]` except it moves the `unsafe` from the function prototype into the macro name, and can be used on safe functions. -```rust,compile_fail -// ERROR: `#[target_feature(..)]` can only be applied to `unsafe` functions -#[target_feature(enable = "avx2")] -fn func() {} -``` - ```rust -// It works, but must be `unsafe` # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[target_feature(enable = "avx2")] unsafe fn func() {} diff --git a/curve25519-dalek/src/backend/vector/avx2/field.rs b/curve25519-dalek/src/backend/vector/avx2/field.rs index d685158..5c42b9c 100644 --- a/curve25519-dalek/src/backend/vector/avx2/field.rs +++ b/curve25519-dalek/src/backend/vector/avx2/field.rs @@ -9,6 +9,11 @@ // - isis agora lovecruft // - Henry de Valence +// Nightly and stable currently disagree on the requirement of unsafe blocks when `unsafe_target_feature` +// gets used. +// See: https://github.com/rust-lang/rust/issues/132856 +#![allow(unused_unsafe)] + //! An implementation of 4-way vectorized 32bit field arithmetic using //! AVX2. //! diff --git a/curve25519-dalek/src/backend/vector/ifma/field.rs b/curve25519-dalek/src/backend/vector/ifma/field.rs index ebdfba1..318f4c2 100644 --- a/curve25519-dalek/src/backend/vector/ifma/field.rs +++ b/curve25519-dalek/src/backend/vector/ifma/field.rs @@ -9,6 +9,10 @@ // - isis agora lovecruft // - Henry de Valence +// Nightly and stable currently disagree on the requirement of unsafe blocks when `unsafe_target_feature` +// gets used. +// See: https://github.com/rust-lang/rust/issues/132856 +#![allow(unused_unsafe)] #![allow(non_snake_case)] use crate::backend::vector::packed_simd::u64x4; diff --git a/curve25519-dalek/src/backend/vector/packed_simd.rs b/curve25519-dalek/src/backend/vector/packed_simd.rs index 61912db..0e1c134 100644 --- a/curve25519-dalek/src/backend/vector/packed_simd.rs +++ b/curve25519-dalek/src/backend/vector/packed_simd.rs @@ -3,6 +3,11 @@ // This file is part of curve25519-dalek. // See LICENSE for licensing information. +// Nightly and stable currently disagree on the requirement of unsafe blocks when `unsafe_target_feature` +// gets used. +// See: https://github.com/rust-lang/rust/issues/132856 +#![allow(unused_unsafe)] + //! This module defines wrappers over platform-specific SIMD types to make them //! more convenient to use. //! diff --git a/ed25519-dalek/Cargo.toml b/ed25519-dalek/Cargo.toml index 626b8da..0c10ed4 100644 --- a/ed25519-dalek/Cargo.toml +++ b/ed25519-dalek/Cargo.toml @@ -16,7 +16,7 @@ keywords = ["cryptography", "ed25519", "curve25519", "signature", "ECC"] categories = ["cryptography", "no-std"] description = "Fast and efficient ed25519 EdDSA key generations, signing, and verification in pure Rust." exclude = [ ".gitignore", "TESTVECTORS", "VALIDATIONVECTORS", "res/*" ] -rust-version = "1.60" +rust-version = "1.81" [package.metadata.docs.rs] rustdoc-args = [