Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/hybrid-array.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
rust:
- 1.81.0 # MSRV
- 1.85.0 # MSRV
- stable
target:
- armv7a-none-eabi
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.81.0 # MSRV
- 1.85.0 # MSRV
- stable
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 14 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,18 +437,20 @@ where
/// state.
#[inline]
pub unsafe fn assume_init(self) -> Array<T, U> {
// `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<T>; 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<T>; 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)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down