| ... | @@ -282,7 +282,7 @@ test "async fn pointer in a struct field" { | ... | @@ -282,7 +282,7 @@ test "async fn pointer in a struct field" { |
| 282 | }; | 282 | }; |
| 283 | var foo = Foo{ .bar = simpleAsyncFn2 }; | 283 | var foo = Foo{ .bar = simpleAsyncFn2 }; |
| 284 | var bytes: [64]u8 align(16) = undefined; | 284 | var bytes: [64]u8 align(16) = undefined; |
| 285 | const f = @asyncCall(&bytes, {}, foo.bar, &data); | 285 | const f = @asyncCall(&bytes, {}, foo.bar, .{&data}); |
| 286 | comptime expect(@TypeOf(f) == anyframe->void); | 286 | comptime expect(@TypeOf(f) == anyframe->void); |
| 287 | expect(data == 2); | 287 | expect(data == 2); |
| 288 | resume f; | 288 | resume f; |
| ... | @@ -318,7 +318,7 @@ test "@asyncCall with return type" { | ... | @@ -318,7 +318,7 @@ test "@asyncCall with return type" { |
| 318 | var foo = Foo{ .bar = Foo.middle }; | 318 | var foo = Foo{ .bar = Foo.middle }; |
| 319 | var bytes: [150]u8 align(16) = undefined; | 319 | var bytes: [150]u8 align(16) = undefined; |
| 320 | var aresult: i32 = 0; | 320 | var aresult: i32 = 0; |
| 321 | _ = @asyncCall(&bytes, &aresult, foo.bar); | 321 | _ = @asyncCall(&bytes, &aresult, foo.bar, .{}); |
| 322 | expect(aresult == 0); | 322 | expect(aresult == 0); |
| 323 | resume Foo.global_frame; | 323 | resume Foo.global_frame; |
| 324 | expect(aresult == 1234); | 324 | expect(aresult == 1234); |
| ... | @@ -332,7 +332,7 @@ test "async fn with inferred error set" { | ... | @@ -332,7 +332,7 @@ test "async fn with inferred error set" { |
| 332 | var frame: [1]@Frame(middle) = undefined; | 332 | var frame: [1]@Frame(middle) = undefined; |
| 333 | var fn_ptr = middle; | 333 | var fn_ptr = middle; |
| 334 | var result: @TypeOf(fn_ptr).ReturnType.ErrorSet!void = undefined; | 334 | var result: @TypeOf(fn_ptr).ReturnType.ErrorSet!void = undefined; |
| 335 | _ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, fn_ptr); | 335 | _ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, fn_ptr, .{}); |
| 336 | resume global_frame; | 336 | resume global_frame; |
| 337 | std.testing.expectError(error.Fail, result); | 337 | std.testing.expectError(error.Fail, result); |
| 338 | } | 338 | } |
| ... | @@ -827,7 +827,7 @@ test "cast fn to async fn when it is inferred to be async" { | ... | @@ -827,7 +827,7 @@ test "cast fn to async fn when it is inferred to be async" { |
| 827 | ptr = func; | 827 | ptr = func; |
| 828 | var buf: [100]u8 align(16) = undefined; | 828 | var buf: [100]u8 align(16) = undefined; |
| 829 | var result: i32 = undefined; | 829 | var result: i32 = undefined; |
| 830 | const f = @asyncCall(&buf, &result, ptr); | 830 | const f = @asyncCall(&buf, &result, ptr, .{}); |
| 831 | _ = await f; | 831 | _ = await f; |
| 832 | expect(result == 1234); | 832 | expect(result == 1234); |
| 833 | ok = true; | 833 | ok = true; |
| ... | @@ -855,7 +855,7 @@ test "cast fn to async fn when it is inferred to be async, awaited directly" { | ... | @@ -855,7 +855,7 @@ test "cast fn to async fn when it is inferred to be async, awaited directly" { |
| 855 | ptr = func; | 855 | ptr = func; |
| 856 | var buf: [100]u8 align(16) = undefined; | 856 | var buf: [100]u8 align(16) = undefined; |
| 857 | var result: i32 = undefined; | 857 | var result: i32 = undefined; |
| 858 | _ = await @asyncCall(&buf, &result, ptr); | 858 | _ = await @asyncCall(&buf, &result, ptr, .{}); |
| 859 | expect(result == 1234); | 859 | expect(result == 1234); |
| 860 | ok = true; | 860 | ok = true; |
| 861 | } | 861 | } |
| ... | @@ -951,7 +951,7 @@ test "@asyncCall with comptime-known function, but not awaited directly" { | ... | @@ -951,7 +951,7 @@ test "@asyncCall with comptime-known function, but not awaited directly" { |
| 951 | fn doTheTest() void { | 951 | fn doTheTest() void { |
| 952 | var frame: [1]@Frame(middle) = undefined; | 952 | var frame: [1]@Frame(middle) = undefined; |
| 953 | var result: @TypeOf(middle).ReturnType.ErrorSet!void = undefined; | 953 | var result: @TypeOf(middle).ReturnType.ErrorSet!void = undefined; |
| 954 | _ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, middle); | 954 | _ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, middle, .{}); |
| 955 | resume global_frame; | 955 | resume global_frame; |
| 956 | std.testing.expectError(error.Fail, result); | 956 | std.testing.expectError(error.Fail, result); |
| 957 | } | 957 | } |
| ... | @@ -982,7 +982,7 @@ test "@asyncCall with actual frame instead of byte buffer" { | ... | @@ -982,7 +982,7 @@ test "@asyncCall with actual frame instead of byte buffer" { |
| 982 | }; | 982 | }; |
| 983 | var frame: @Frame(S.func) = undefined; | 983 | var frame: @Frame(S.func) = undefined; |
| 984 | var result: i32 = undefined; | 984 | var result: i32 = undefined; |
| 985 | const ptr = @asyncCall(&frame, &result, S.func); | 985 | const ptr = @asyncCall(&frame, &result, S.func, .{}); |
| 986 | resume ptr; | 986 | resume ptr; |
| 987 | expect(result == 1234); | 987 | expect(result == 1234); |
| 988 | } | 988 | } |
| ... | @@ -1005,7 +1005,7 @@ test "@asyncCall using the result location inside the frame" { | ... | @@ -1005,7 +1005,7 @@ test "@asyncCall using the result location inside the frame" { |
| 1005 | }; | 1005 | }; |
| 1006 | var foo = Foo{ .bar = S.simple2 }; | 1006 | var foo = Foo{ .bar = S.simple2 }; |
| 1007 | var bytes: [64]u8 align(16) = undefined; | 1007 | var bytes: [64]u8 align(16) = undefined; |
| 1008 | const f = @asyncCall(&bytes, {}, foo.bar, &data); | 1008 | const f = @asyncCall(&bytes, {}, foo.bar, .{&data}); |
| 1009 | comptime expect(@TypeOf(f) == anyframe->i32); | 1009 | comptime expect(@TypeOf(f) == anyframe->i32); |
| 1010 | expect(data == 2); | 1010 | expect(data == 2); |
| 1011 | resume f; | 1011 | resume f; |
| ... | @@ -1042,7 +1042,7 @@ test "using @TypeOf on a generic function call" { | ... | @@ -1042,7 +1042,7 @@ test "using @TypeOf on a generic function call" { |
| 1042 | } | 1042 | } |
| 1043 | const F = @TypeOf(async amain(x - 1)); | 1043 | const F = @TypeOf(async amain(x - 1)); |
| 1044 | const frame = @intToPtr(*F, @ptrToInt(&buf)); | 1044 | const frame = @intToPtr(*F, @ptrToInt(&buf)); |
| 1045 | return await @asyncCall(frame, {}, amain, x - 1); | 1045 | return await @asyncCall(frame, {}, amain, .{x - 1}); |
| 1046 | } | 1046 | } |
| 1047 | }; | 1047 | }; |
| 1048 | _ = async S.amain(@as(u32, 1)); | 1048 | _ = async S.amain(@as(u32, 1)); |
| ... | @@ -1067,7 +1067,7 @@ test "recursive call of await @asyncCall with struct return type" { | ... | @@ -1067,7 +1067,7 @@ test "recursive call of await @asyncCall with struct return type" { |
| 1067 | } | 1067 | } |
| 1068 | const F = @TypeOf(async amain(x - 1)); | 1068 | const F = @TypeOf(async amain(x - 1)); |
| 1069 | const frame = @intToPtr(*F, @ptrToInt(&buf)); | 1069 | const frame = @intToPtr(*F, @ptrToInt(&buf)); |
| 1070 | return await @asyncCall(frame, {}, amain, x - 1); | 1070 | return await @asyncCall(frame, {}, amain, .{x - 1}); |
| 1071 | } | 1071 | } |
| 1072 | | 1072 | |
| 1073 | const Foo = struct { | 1073 | const Foo = struct { |
| ... | @@ -1078,7 +1078,7 @@ test "recursive call of await @asyncCall with struct return type" { | ... | @@ -1078,7 +1078,7 @@ test "recursive call of await @asyncCall with struct return type" { |
| 1078 | }; | 1078 | }; |
| 1079 | var res: S.Foo = undefined; | 1079 | var res: S.Foo = undefined; |
| 1080 | var frame: @TypeOf(async S.amain(@as(u32, 1))) = undefined; | 1080 | var frame: @TypeOf(async S.amain(@as(u32, 1))) = undefined; |
| 1081 | _ = @asyncCall(&frame, &res, S.amain, @as(u32, 1)); | 1081 | _ = @asyncCall(&frame, &res, S.amain, .{@as(u32, 1)}); |
| 1082 | resume S.global_frame; | 1082 | resume S.global_frame; |
| 1083 | expect(S.global_ok); | 1083 | expect(S.global_ok); |
| 1084 | expect(res.x == 1); | 1084 | expect(res.x == 1); |
| ... | @@ -1377,7 +1377,7 @@ test "async function call resolves target fn frame, comptime func" { | ... | @@ -1377,7 +1377,7 @@ test "async function call resolves target fn frame, comptime func" { |
| 1377 | fn foo() anyerror!void { | 1377 | fn foo() anyerror!void { |
| 1378 | const stack_size = 1000; | 1378 | const stack_size = 1000; |
| 1379 | var stack_frame: [stack_size]u8 align(std.Target.stack_align) = undefined; | 1379 | var stack_frame: [stack_size]u8 align(std.Target.stack_align) = undefined; |
| 1380 | return await @asyncCall(&stack_frame, {}, bar); | 1380 | return await @asyncCall(&stack_frame, {}, bar, .{}); |
| 1381 | } | 1381 | } |
| 1382 | | 1382 | |
| 1383 | fn bar() anyerror!void { | 1383 | fn bar() anyerror!void { |
| ... | @@ -1400,7 +1400,7 @@ test "async function call resolves target fn frame, runtime func" { | ... | @@ -1400,7 +1400,7 @@ test "async function call resolves target fn frame, runtime func" { |
| 1400 | const stack_size = 1000; | 1400 | const stack_size = 1000; |
| 1401 | var stack_frame: [stack_size]u8 align(std.Target.stack_align) = undefined; | 1401 | var stack_frame: [stack_size]u8 align(std.Target.stack_align) = undefined; |
| 1402 | var func: fn () callconv(.Async) anyerror!void = bar; | 1402 | var func: fn () callconv(.Async) anyerror!void = bar; |
| 1403 | return await @asyncCall(&stack_frame, {}, func); | 1403 | return await @asyncCall(&stack_frame, {}, func, .{}); |
| 1404 | } | 1404 | } |
| 1405 | | 1405 | |
| 1406 | fn bar() anyerror!void { | 1406 | fn bar() anyerror!void { |