-
NonZero Link
Seems like the issue is Zero or .get() is not associated with T, generic type. We are also unable to compare variables and recommended to add PartialEq, but we see it already exists in line 172:
Maybe we are calling it incorrectly? We also added PartialEq to the implementation block for new_unchecked but also received errors. Would it be better to just use kani::proof with assume / asset for this type of harness? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yeah, I understand the problem. The implementation for some of the In that case, I believe we'll have to work on a byte basis. For example, in order to check if a value is zero, you could get the address of the value, and create a The same idea can be applied to compare values using byte comparison. Please let me know if that makes sense or if anyone has any other solution. |
Beta Was this translation helpful? Give feedback.
Yeah, I understand the problem. The implementation for some of the
NonZero<T>
methods only requiresT: ZeroablePrimitive
, which doesn't provide any method to inspect or compare theT
value.In that case, I believe we'll have to work on a byte basis. For example, in order to check if a value is zero, you could get the address of the value, and create a
*const [u8]
where the len of the slice is the size of T. Then, you assume that it is safe to read from this slice, and check if any of the bytes is different than zero.The same idea can be applied to compare values using byte comparison.
Please let me know if that makes sense or if anyone has any other solution.