From 9ff9316a53d03e14c267aa6dcc45c478bfb2b12a Mon Sep 17 00:00:00 2001 From: ordian Date: Sat, 10 Aug 2024 15:20:44 +0200 Subject: [PATCH] fix compile errors with new Rust (#854) * fix compile errors with new Rust * try fixing rug compilation error --- bounded-collections/src/bounded_btree_map.rs | 3 ++- bounded-collections/src/bounded_btree_set.rs | 3 ++- bounded-collections/src/bounded_vec.rs | 5 +++-- fixed-hash/src/hash.rs | 1 - uint/Cargo.toml | 5 ++++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bounded-collections/src/bounded_btree_map.rs b/bounded-collections/src/bounded_btree_map.rs index de975801..c3369c19 100644 --- a/bounded-collections/src/bounded_btree_map.rs +++ b/bounded-collections/src/bounded_btree_map.rs @@ -655,10 +655,11 @@ mod test { #[test] #[cfg(feature = "std")] fn container_can_derive_hash() { - #[derive(Hash)] + #[derive(Hash, Default)] struct Foo { bar: u8, map: BoundedBTreeMap>, } + let _foo = Foo::default(); } } diff --git a/bounded-collections/src/bounded_btree_set.rs b/bounded-collections/src/bounded_btree_set.rs index c966bce8..e651c862 100644 --- a/bounded-collections/src/bounded_btree_set.rs +++ b/bounded-collections/src/bounded_btree_set.rs @@ -579,11 +579,12 @@ mod test { #[test] #[cfg(feature = "std")] fn container_can_derive_hash() { - #[derive(Hash)] + #[derive(Hash, Default)] struct Foo { bar: u8, set: BoundedBTreeSet>, } + let _foo = Foo::default(); } #[cfg(feature = "serde")] diff --git a/bounded-collections/src/bounded_vec.rs b/bounded-collections/src/bounded_vec.rs index c8c7e87a..4d56971e 100644 --- a/bounded-collections/src/bounded_vec.rs +++ b/bounded-collections/src/bounded_vec.rs @@ -925,7 +925,7 @@ where #[cfg(all(test, feature = "std"))] mod test { use super::*; - use crate::{bounded_vec, ConstU32, ConstU8}; + use crate::{bounded_vec, ConstU32}; use codec::CompactLen; #[test] @@ -1363,8 +1363,9 @@ mod test { #[derive(Hash)] struct Foo<'a> { bar: u8, - slice: BoundedSlice<'a, usize, ConstU8<8>>, + slice: BoundedSlice<'a, usize, ConstU32<4>>, map: BoundedVec>, } + let _foo = Foo { bar: 42, slice: BoundedSlice::truncate_from(&[0, 1][..]), map: BoundedVec::default() }; } } diff --git a/fixed-hash/src/hash.rs b/fixed-hash/src/hash.rs index 20f3864e..a5c1ed41 100644 --- a/fixed-hash/src/hash.rs +++ b/fixed-hash/src/hash.rs @@ -255,7 +255,6 @@ macro_rules! construct_fixed_hash { impl $crate::core_::marker::Copy for $name {} - #[cfg_attr(feature = "dev", allow(expl_impl_clone_on_copy))] impl $crate::core_::clone::Clone for $name { fn clone(&self) -> $name { *self diff --git a/uint/Cargo.toml b/uint/Cargo.toml index 36f3de1b..44bef00d 100644 --- a/uint/Cargo.toml +++ b/uint/Cargo.toml @@ -34,7 +34,10 @@ criterion = "0.5.1" num-bigint = "0.4.0" [target.'cfg(all(unix, target_arch = "x86_64"))'.dev-dependencies] -rug = { version = "1.6.0", default-features = false, features = ["integer"] } +rug = { version = "1.6.0", default-features = false, features = [ + "integer", + "std", +] } [[bench]] name = "bigint"