Commit 859fd09 1 parent 225380e commit 859fd09 Copy full SHA for 859fd09
File tree 2 files changed +26
-13
lines changed
SwiftRustIntegrationTestRunner/SwiftRustIntegrationTestRunner
crates/swift-integration-tests/src
2 files changed +26
-13
lines changed Original file line number Diff line number Diff line change 6
6
//
7
7
8
8
func swift_func_takes_callback_with_result_arg(
9
- arg: ( RustResult < CallbackTestOpaqueRustType , String > ) -> ( )
9
+ arg: ( RustResult < CallbackTestOpaqueRustType , String > ) -> Void
10
10
) {
11
- arg ( . Ok( CallbackTestOpaqueRustType ( 555 ) ) )
11
+ arg ( . Ok( CallbackTestOpaqueRustType ( 555 ) ) )
12
12
}
13
13
14
14
public class ResultTestOpaqueSwiftType {
15
- var num : UInt32
16
-
17
- init ( val: UInt32 ) {
18
- self . num = val
19
- }
20
-
21
- func val( ) -> UInt32 {
22
- self . num
23
- }
15
+ var num : UInt32
16
+
17
+ init ( val: UInt32 ) {
18
+ self . num = val
19
+ }
20
+
21
+ func val( ) -> UInt32 {
22
+ self . num
23
+ }
24
24
}
25
25
26
+ // TODO: we can delete these type assertions once we correctly generate Sendable
27
+ // types. See the following issue:
28
+ // https://github.com/chinedufn/swift-bridge/issues/150
29
+
30
+ extension AsyncRustFnReturnStruct : @unchecked Sendable { }
31
+
26
32
extension ResultTestOpaqueRustType : @unchecked Sendable { }
27
33
extension ResultTestOpaqueRustType : Error { }
28
34
@@ -41,5 +47,7 @@ extension ResultTransparentStruct: Error {}
41
47
extension SameEnum : @unchecked Sendable { }
42
48
extension SameEnum : Error { }
43
49
50
+ extension AsyncResultOkEnum : @unchecked Sendable { }
51
+
44
52
extension AsyncResultErrEnum : @unchecked Sendable { }
45
53
extension AsyncResultErrEnum : Error { }
Original file line number Diff line number Diff line change @@ -13,14 +13,19 @@ mod ffi {
13
13
extern "Rust" {
14
14
async fn rust_async_return_null ( ) ;
15
15
async fn rust_async_reflect_u8 ( arg : u8 ) -> u8 ;
16
- async fn rust_async_reflect_string ( string : String ) -> String ;
16
+
17
17
async fn rust_async_return_struct ( ) -> AsyncRustFnReturnStruct ;
18
18
async fn rust_async_func_reflect_result_opaque_rust (
19
19
arg : Result < AsyncResultOpaqueRustType1 , AsyncResultOpaqueRustType2 > ,
20
20
) -> Result < AsyncResultOpaqueRustType1 , AsyncResultOpaqueRustType2 > ;
21
21
async fn rust_async_func_return_result_null_opaque_rust (
22
22
succeed : bool ,
23
23
) -> Result < ( ) , AsyncResultOpaqueRustType2 > ;
24
+
25
+ // TODO: this is broken because RustString is not Sendable.
26
+ // Work around making String and other opaque types Sendable is tracked
27
+ // here: https://github.com/chinedufn/swift-bridge/issues/150
28
+ // async fn rust_async_reflect_string(string: String) -> String;
24
29
}
25
30
26
31
extern "Rust" {
@@ -49,7 +54,7 @@ mod ffi {
49
54
50
55
enum AsyncResultOkEnum {
51
56
NoFields ,
52
- UnnamedFields ( i32 , String ) ,
57
+ UnnamedFields ( i32 , u32 ) ,
53
58
NamedFields { value : u8 } ,
54
59
}
55
60
You can’t perform that action at this time.
0 commit comments