Skip to content

Commit

Permalink
Add Sendable to all async return types in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmarc committed Jan 27, 2025
1 parent 225380e commit 9e341f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
//

func swift_func_takes_callback_with_result_arg(
arg: (RustResult<CallbackTestOpaqueRustType, String>) -> ()
arg: (RustResult<CallbackTestOpaqueRustType, String>) -> Void
) {
arg(.Ok(CallbackTestOpaqueRustType(555)))
}

public class ResultTestOpaqueSwiftType {
var num: UInt32

init(val: UInt32) {
self.num = val
}

func val() -> UInt32 {
self.num
}
}

extension AsyncRustFnReturnStruct: @unchecked Sendable {}

extension ResultTestOpaqueRustType: @unchecked Sendable {}
extension ResultTestOpaqueRustType: Error {}

Expand All @@ -41,5 +43,7 @@ extension ResultTransparentStruct: Error {}
extension SameEnum: @unchecked Sendable {}
extension SameEnum: Error {}

extension AsyncResultOkEnum: @unchecked Sendable {}

extension AsyncResultErrEnum: @unchecked Sendable {}
extension AsyncResultErrEnum: Error {}
3 changes: 2 additions & 1 deletion crates/swift-integration-tests/src/async_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ mod ffi {
extern "Rust" {
async fn rust_async_return_null();
async fn rust_async_reflect_u8(arg: u8) -> u8;
async fn rust_async_reflect_string(string: String) -> String;
// TODO: this is broken because RustString is not Sendable.
// async fn rust_async_reflect_string(string: String) -> String;
async fn rust_async_return_struct() -> AsyncRustFnReturnStruct;
async fn rust_async_func_reflect_result_opaque_rust(
arg: Result<AsyncResultOpaqueRustType1, AsyncResultOpaqueRustType2>,
Expand Down

0 comments on commit 9e341f9

Please sign in to comment.