-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add package name to RustBufferI if it needs it #44
Conversation
I'm trying to wrap my head around when does this happen. Is there a simple way to repro this inside the tests? I think there are already some tests for "external" types |
It only happens on async functions when the value being returned is in another package. In that case, both packages have There isn't a simple way to reproduce the test due to #45 - I could probably write a test in a completely separate test package and then |
Oh sorry, I misunderstood your previous comment. So #43 only happens with async code? I would really appreciate to have either an actual test case for this, or at least explain the offending configuration in a comment above #45 is a runtime error, but #43 is a compile time error, so I think it should be possible to reproduce #43 despite the existence of #45. |
Yup, I have a working regression test now in a new package
which requires this PR to produce code that compiles, which produces a func(handle *C.void, status *C.RustCallStatus) issue45.RustBufferI {
// completeFunc
return C.ffi_uniffi_go_issue43_rust_future_complete_rust_buffer(unsafe.Pointer(handle), status)
}, whereas without #44 it would just be |
Signed-off-by: Kegan Dougal <[email protected]>
Rebased as #46 landed. It should be pretty clear now! |
Nice work! I finally understand why this error only happens with async 😅 My initial reaction was that this should also happen with regular functions, e.g. func GetAsyncExternalType() issue45.Record {
return issue45.FfiConverterTypeRecordINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI {
return C.uniffi_uniffi_go_issue43_fn_func_get_async_external_type(_uniffiStatus)
}))
} In this example there is also a type mismatch between what Contrast that with async code, where |
Signed-off-by: Kegan Dougal <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks for contributing!
Fixes #43