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

custom_type!() for remote types in latest version? #2401

Open
chris13524 opened this issue Jan 14, 2025 · 1 comment
Open

custom_type!() for remote types in latest version? #2401

chris13524 opened this issue Jan 14, 2025 · 1 comment

Comments

@chris13524
Copy link

We upgraded to the latest commit ref (c7c4809ed0e6bb9195b58855cc7cb211eac13290) (previously e796e00ad150f8b14b61a859a2e8c6497b35074e) and it seems that custom_type!() stopped working for us:

error[E0210]: type parameter `UT` must be used as the type parameter for some local type (e.g., `MyStruct<UT>`)
  --> crates/yttrium/src/uniffi_compat.rs:25:1
   |
25 | / uniffi::custom_type!(Address, String, {
26 | |     try_lift: |val| Ok(val.parse()?),
27 | |     lower: |obj| obj.to_string(),
28 | | });
   | |__^ type parameter `UT` must be used as the type parameter for some local type
   |
   = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
   = note: only traits defined in the current crate can be implemented for a type parameter
   = note: this error originates in the macro `uniffi::custom_type` (in Nightly builds, run with -Z macro-backtrace for more info)

We are using the external crate's alloy::primitives::Address here, and lowering it to a string so it can be used on the Kotlin side easily as a string.

Do custom types no longer work in the latest version for remote types? Or is there possibly another reason for this error?

In our case, it would be convenient to continue lowering this to a string vs exposing a full Address type Kotlin-side requiring refactors.

@mhammond
Copy link
Member

Is this just a "remote custom type"?

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

No branches or pull requests

2 participants