diff --git a/src/consensus/encode.rs b/src/consensus/encode.rs index bdda57c7..05004055 100644 --- a/src/consensus/encode.rs +++ b/src/consensus/encode.rs @@ -249,7 +249,7 @@ macro_rules! decoder_fn { ($name:ident, $val_type:ty, $readfn:ident, $byte_len: expr) => { #[inline] fn $name(&mut self) -> Result<$val_type, Error> { - assert_eq!(::std::mem::size_of::<$val_type>(), $byte_len); // size_of isn't a constfn in 1.22 + debug_assert_eq!(::std::mem::size_of::<$val_type>(), $byte_len); // size_of isn't a constfn in 1.22 let mut val = [0; $byte_len]; self.read_exact(&mut val[..]).map_err(Error::Io)?; Ok(endian::$readfn(&val)) diff --git a/src/util/endian.rs b/src/util/endian.rs index 37b59a19..d4ae5ec4 100644 --- a/src/util/endian.rs +++ b/src/util/endian.rs @@ -28,7 +28,7 @@ macro_rules! define_be_to_array { ($name: ident, $type: ty, $byte_len: expr) => { #[inline] pub fn $name(val: $type) -> [u8; $byte_len] { - assert_eq!(::std::mem::size_of::<$type>(), $byte_len); // size_of isn't a constfn in 1.22 + debug_assert_eq!(::std::mem::size_of::<$type>(), $byte_len); // size_of isn't a constfn in 1.22 let mut res = [0; $byte_len]; for i in 0..$byte_len { res[i] = ((val >> ($byte_len - i - 1)*8) & 0xff) as u8; @@ -41,7 +41,7 @@ macro_rules! define_le_to_array { ($name: ident, $type: ty, $byte_len: expr) => { #[inline] pub fn $name(val: $type) -> [u8; $byte_len] { - assert_eq!(::std::mem::size_of::<$type>(), $byte_len); // size_of isn't a constfn in 1.22 + debug_assert_eq!(::std::mem::size_of::<$type>(), $byte_len); // size_of isn't a constfn in 1.22 let mut res = [0; $byte_len]; for i in 0..$byte_len { res[i] = ((val >> i*8) & 0xff) as u8;