From 2601fc6c68139c551f23641050e0fa90e6849272 Mon Sep 17 00:00:00 2001 From: xcshuan Date: Thu, 28 Mar 2024 14:37:21 +0800 Subject: [PATCH 1/3] fix num-traits with no-std --- src/support/num_traits.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/support/num_traits.rs b/src/support/num_traits.rs index f74f857f..b5d2542c 100644 --- a/src/support/num_traits.rs +++ b/src/support/num_traits.rs @@ -26,6 +26,10 @@ use num_traits::{ CheckedEuclid, Euclid, Inv, MulAdd, MulAddAssign, Num, NumCast, }; +#[cfg(feature = "alloc")] +#[allow(unused_imports)] +use alloc::vec::Vec; + // TODO: AsPrimitive // Note. We can not implement `NumBytes` as it requires T to be `AsMut<[u8]>`. From 4d58e564101db5dc0913185b0c868248cdef5e93 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 28 Mar 2024 13:55:01 -0700 Subject: [PATCH 2/3] fix: num-traits feature enables alloc --- Cargo.toml | 1 + src/support/num_traits.rs | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 045830b2..a6be20f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,6 +125,7 @@ ark-ff-04 = ["dep:ark-ff-04"] bn-rs = ["dep:bn-rs", "std"] fastrlp = ["dep:fastrlp", "alloc"] num-bigint = ["dep:num-bigint", "alloc"] +num-traits = ["dep:num-traits", "alloc"] parity-scale-codec = ["dep:parity-scale-codec", "alloc"] primitive-types = ["dep:primitive-types"] proptest = ["dep:proptest", "std"] # TODO: change to "alloc" on the next proptest release (>1.2.0) diff --git a/src/support/num_traits.rs b/src/support/num_traits.rs index b5d2542c..e73d5f9b 100644 --- a/src/support/num_traits.rs +++ b/src/support/num_traits.rs @@ -26,8 +26,7 @@ use num_traits::{ CheckedEuclid, Euclid, Inv, MulAdd, MulAddAssign, Num, NumCast, }; -#[cfg(feature = "alloc")] -#[allow(unused_imports)] +#[cfg(not(feature = "std"))] use alloc::vec::Vec; // TODO: AsPrimitive From 07f88958dbfecd09110dcc10d6209511aa289994 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 29 Mar 2024 10:00:56 -0700 Subject: [PATCH 3/3] chore: changelog and version bump --- CHANGELOG.md | 6 ++++++ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27c366b8..1e96b133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- add `alloc` requirement to `num-traits` feature [#363] + +[#363]: https://github.com/recmo/uint/pull/363 + ## [1.12.1] - 2024-03-12 ### Fixed diff --git a/Cargo.toml b/Cargo.toml index a6be20f6..d7ad8483 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ruint" description = "Unsigned integer type with const-generic bit length" -version = "1.12.1" +version = "1.12.2" keywords = ["uint"] categories = ["mathematics"] include = [".cargo/", "src/", "README.md"]