diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cc8a51..494d69b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,18 @@ jobs: - name: Run Cargo test run: cargo +nightly test --all-features + test-msrv: + runs-on: ubuntu-latest + steps: + - name: Install stable 1.70 toolchain + uses: dtolnay/rust-toolchain@1.70 + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run Cargo test + run: cargo test --features serde,typesize + clippy-stable: runs-on: ubuntu-latest steps: diff --git a/Cargo.toml b/Cargo.toml index ba6553c..21cda99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "small-fixed-array" description = "A crate providing fixed length immutable collections with a low memory footprint." repository = "https://github.com/GnomedDev/small-fixed-array" +rust-version = "1.70" version = "0.4.0" edition = "2021" license = "MIT" diff --git a/src/array.rs b/src/array.rs index 686b86a..eb53eca 100644 --- a/src/array.rs +++ b/src/array.rs @@ -162,7 +162,7 @@ impl Default for FixedArray { impl Clone for FixedArray { fn clone(&self) -> Self { - let ptr = Box::<[T]>::from(self.as_slice()); + let ptr = self.as_slice().to_vec().into_boxed_slice(); // SAFETY: The Box::from cannot make the length mismatch. unsafe { Self::from_box_with_nonzero(ptr, self.len) } diff --git a/src/lib.rs b/src/lib.rs index 7c4aa5e..70c1e7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,10 @@ //! - `nightly`: Speeds up [`FixedString::len`] for small strings, using `portable_simd`. //! - `serde`: Provides [`serde`] implementations for [`FixedArray`] and [`FixedString`]. //! - `typesize`: Provides [`typesize`] implementations for [`FixedArray`] and [`FixedString`]. +//! +//! ## MSRV +//! The minimum supported Rust version for this crate is currently `1.70`, however this may be broken by dependencies, +//! to work around this breakage, use the unstable `minimal-versions` cargo flag if MSRV is important to you. #![cfg_attr(feature = "nightly", feature(portable_simd))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![cfg_attr(not(feature = "std"), no_std)]