Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Cannot use an Option with a UDT as T #1432

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

willemneal
Copy link
Member

With this change you get the following compiler error:

error[E0277]: the trait bound `soroban_env_host::xdr::ScVal: TryFrom<&std::option::Option<InnerUdt>>` is not satisfied
  --> soroban-sdk/src/tests/contract_udt_option.rs:11:1
   |
11 | #[contracttype]
   | ^^^^^^^^^^^^^^^ the trait `From<InnerUdt>` is not implemented for `soroban_env_host::xdr::ScVal`, which is required by `&std::option::Option<InnerUdt>: TryInto<_>`
   |
   = help: the following other types implement trait `From<T>`:
             `&'a soroban_env_host::xdr::ScVal` implements `From<ScValObjRef<'a>>`
             `soroban_env_host::xdr::ScVal` implements `From<&()>`
             `soroban_env_host::xdr::ScVal` implements `From<&address::Address>`
             `soroban_env_host::xdr::ScVal` implements `From<&bool>`
             `soroban_env_host::xdr::ScVal` implements `From<&bytes::Bytes>`
             `soroban_env_host::xdr::ScVal` implements `From<&i128>`
             `soroban_env_host::xdr::ScVal` implements `From<&i32>`
             `soroban_env_host::xdr::ScVal` implements `From<&i64>`
           and 36 others
   = note: required for `InnerUdt` to implement `Into<soroban_env_host::xdr::ScVal>`
   = note: required for `soroban_env_host::xdr::ScVal` to implement `From<&std::option::Option<InnerUdt>>`
   = note: 1 redundant requirement hidden
   = note: required for `&std::option::Option<InnerUdt>` to implement `Into<soroban_env_host::xdr::ScVal>`
   = note: required for `soroban_env_host::xdr::ScVal` to implement `TryFrom<&std::option::Option<InnerUdt>>`
   = note: required for `&std::option::Option<InnerUdt>` to implement `TryInto<soroban_env_host::xdr::ScVal>`
   = note: this error originates in the attribute macro `contracttype` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant