Open leighmcculloch opened 5 hours ago
I believe the issue is that when we build for tests we also code generate implementations for converting types from a variety of Sc*
XDR types like ScVal
and ScVec
. Those conversion are only implemented for conversion from borrows, e.g. &ScVal
, not from owned types, e.g. ScVal
.
I don't remember why the conversions are limited to borrows, we could potentially go and add in conversions without the borrows too.
Another way to fix this may be to alter the generated code to appropriately "as_ref" each value, which would result in a the Option<ScVal>
being used as a Option<&ScVal>
. This solution would be preferred because very likely the reason we are borrowing is to not deconstruct the type, so even if we filled in the other above, it probably wouldn't be sufficient.
I took a look to see if there was a quick fix here. The as_ref
idea won’t work because not all types support it. I tried adding support for impl From<Option<T>> for ScVal where
&Tis convertible, instead of the existing where
T` is convertible, but ended up with recursion issues. This requires a more significant time investment to solve.
What version are you using?
21.7.6
22.0.0-rc.3
What did you do?
What did you expect to see?
Build success when building for tests.
What did you see instead?
cc @kalepail