diff --git a/.github/workflows/hybrid-array.yml b/.github/workflows/hybrid-array.yml index 13d8bf5..ad71bac 100644 --- a/.github/workflows/hybrid-array.yml +++ b/.github/workflows/hybrid-array.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: rust: - - 1.81.0 # MSRV + - 1.85.0 # MSRV - stable target: - armv7a-none-eabi @@ -57,7 +57,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.84.0 + toolchain: 1.85.0 components: clippy - run: cargo clippy --all-targets --all-features -- -D warnings @@ -99,7 +99,7 @@ jobs: strategy: matrix: toolchain: - - 1.81.0 # MSRV + - 1.85.0 # MSRV - stable runs-on: ubuntu-latest steps: diff --git a/Cargo.lock b/Cargo.lock index 7439cb2..96acf03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "bincode" @@ -19,7 +19,7 @@ checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" [[package]] name = "hybrid-array" -version = "0.2.3" +version = "0.3.0-pre" dependencies = [ "bincode", "bytemuck", diff --git a/Cargo.toml b/Cargo.toml index b068516..ebc06bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hybrid-array" -version = "0.2.3" +version = "0.3.0-pre" description = """ Hybrid typenum-based and const generic array types designed to provide the flexibility of typenum-based expressions while also allowing interoperability @@ -13,8 +13,8 @@ repository = "https://github.com/RustCrypto/hybrid-array" categories = ["no-std", "data-structures"] keywords = ["generic-array"] readme = "README.md" -edition = "2021" -rust-version = "1.81" +edition = "2024" +rust-version = "1.85" [dependencies] typenum = { version = "1.17", features = ["const-generics"] } diff --git a/README.md b/README.md index 4227b0a..7aae41e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ dual licensed as above, without any additional terms or conditions. [build-image]: https://github.com/RustCrypto/utils/workflows/hybrid-array/badge.svg [build-link]: https://github.com/RustCrypto/utils/actions/workflows/hybrid-array.yml [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg [chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg [chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260052-utils diff --git a/src/lib.rs b/src/lib.rs index 173c1e6..7ccc9ed 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -437,18 +437,20 @@ where /// state. #[inline] pub unsafe fn assume_init(self) -> Array { - // `Array` is a `repr(transparent)` newtype for a generic inner type which is constrained to - // be `[T; N]` by the `ArraySize` impls in this crate. - // - // Since we're working with a type-erased inner type and ultimately trying to convert - // `[MaybeUninit; N]` to `[T; N]`, we can't use simpler approaches like a pointer cast - // or `transmute`, since the compiler can't prove to itself that the size will be the same. - // - // We've taken unique ownership of `self`, which is a `MaybeUninit` array, and as such we - // don't need to worry about `Drop` impls because `MaybeUninit` does not impl `Drop`. - // Since we have unique ownership of `self`, it's okay to make a copy because we're throwing - // the original away (and this should all get optimized to a noop by the compiler, anyway). - mem::transmute_copy(&self) + unsafe { + // `Array` is a `repr(transparent)` newtype for a generic inner type which is constrained to + // be `[T; N]` by the `ArraySize` impls in this crate. + // + // Since we're working with a type-erased inner type and ultimately trying to convert + // `[MaybeUninit; N]` to `[T; N]`, we can't use simpler approaches like a pointer cast + // or `transmute`, since the compiler can't prove to itself that the size will be the same. + // + // We've taken unique ownership of `self`, which is a `MaybeUninit` array, and as such we + // don't need to worry about `Drop` impls because `MaybeUninit` does not impl `Drop`. + // Since we have unique ownership of `self`, it's okay to make a copy because we're throwing + // the original away (and this should all get optimized to a noop by the compiler, anyway). + mem::transmute_copy(&self) + } } } diff --git a/src/serde.rs b/src/serde.rs index f5bd0e2..6e98db1 100644 --- a/src/serde.rs +++ b/src/serde.rs @@ -75,8 +75,8 @@ where mod tests { const INTEGER_ARRAY_EXAMPLE: [u64; 4] = [1, 2, 3, 4]; use crate::{ - sizes::{U4, U5}, Array, + sizes::{U4, U5}, }; #[test] diff --git a/src/sizes.rs b/src/sizes.rs index dc4e6e2..dea0ee1 100644 --- a/src/sizes.rs +++ b/src/sizes.rs @@ -601,8 +601,8 @@ impl_array_sizes_with_import! { mod extra_sizes { use super::{ArraySize, AssocArraySize}; use typenum::{ - consts::{B0, B1}, UInt, UTerm, + consts::{B0, B1}, }; // This macro constructs a UInt type from a sequence of bits. The bits are interpreted as the