Skip to content

Commit 624bb0b

Browse files
author
setup
committed
Add std cfg for visit_seq function - same as visit_bytes
1 parent 57d47c8 commit 624bb0b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/range_proof/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,14 @@ impl<'de> Deserialize<'de> for RangeProof {
570570
while let Some(elem) = seq.next_element()? {
571571
vec.push(elem);
572572
}
573+
// Using Error::custom requires T: Display, which our error
574+
// type only implements when it implements std::error::Error.
575+
#[cfg(feature = "std")]
573576
return RangeProof::from_bytes(&*vec).map_err(serde::de::Error::custom);
577+
// In no-std contexts, drop the error message.
578+
#[cfg(not(feature = "std"))]
579+
return RangeProof::from_bytes(&*vec)
580+
.map_err(|_| serde::de::Error::custom("deserialization error"));
574581
}
575582

576583
fn visit_bytes<E>(self, v: &[u8]) -> Result<RangeProof, E>

0 commit comments

Comments
 (0)