-
Notifications
You must be signed in to change notification settings - Fork 76
Add Sendable to all async return types in tests #312
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,23 +6,29 @@ | |||||||||||
| // | ||||||||||||
|
|
||||||||||||
| func swift_func_takes_callback_with_result_arg( | ||||||||||||
| arg: (RustResult<CallbackTestOpaqueRustType, String>) -> () | ||||||||||||
| arg: (RustResult<CallbackTestOpaqueRustType, String>) -> Void | ||||||||||||
| ) { | ||||||||||||
| arg(.Ok(CallbackTestOpaqueRustType(555))) | ||||||||||||
| arg(.Ok(CallbackTestOpaqueRustType(555))) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| public class ResultTestOpaqueSwiftType { | ||||||||||||
| var num: UInt32 | ||||||||||||
| init(val: UInt32) { | ||||||||||||
| self.num = val | ||||||||||||
| } | ||||||||||||
| func val() -> UInt32 { | ||||||||||||
| self.num | ||||||||||||
| } | ||||||||||||
| var num: UInt32 | ||||||||||||
|
|
||||||||||||
| init(val: UInt32) { | ||||||||||||
| self.num = val | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| func val() -> UInt32 { | ||||||||||||
| self.num | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // TODO: we can delete these type assertions once we correctly generate Sendable | ||||||||||||
| // types. See the following issue: | ||||||||||||
| // https://github.com/chinedufn/swift-bridge/issues/150 | ||||||||||||
|
|
||||||||||||
| extension AsyncRustFnReturnStruct: @unchecked Sendable {} | ||||||||||||
|
|
||||||||||||
| extension ResultTestOpaqueRustType: @unchecked Sendable {} | ||||||||||||
| extension ResultTestOpaqueRustType: Error {} | ||||||||||||
|
|
||||||||||||
|
|
@@ -41,5 +47,7 @@ extension ResultTransparentStruct: Error {} | |||||||||||
| extension SameEnum: @unchecked Sendable {} | ||||||||||||
| extension SameEnum: Error {} | ||||||||||||
|
|
||||||||||||
| extension AsyncResultOkEnum: @unchecked Sendable {} | ||||||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm we'll want to move away from these In the meantime, you can make this swift-bridge/crates/swift-integration-tests/src/async_function.rs Lines 50 to 54 in 636fa27
Let's also leave a TODO in this file to ditch
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For future reference, I think you linked the wrong issue by accident - the relevant one is #150. |
||||||||||||
|
|
||||||||||||
| extension AsyncResultErrEnum: @unchecked Sendable {} | ||||||||||||
| extension AsyncResultErrEnum: Error {} | ||||||||||||
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.
Currently safe since this struct only contains a primitive
swift-bridge/crates/swift-integration-tests/src/async_function.rs
Lines 8 to 11 in 636fa27
But we'll still eventually want to replace all of these
@unchecked Sendablewith properswift-bridgesupport for emittingSendableimpls as described in #269