Skip to content

Commit d55c8b8

Browse files
committed
update docs/tests for async/extern fn removal
1 parent 9ae2f17 commit d55c8b8

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

doc/langref.html.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6713,7 +6713,7 @@ const assert = std.debug.assert;
67136713
test "async fn pointer in a struct field" {
67146714
var data: i32 = 1;
67156715
const Foo = struct {
6716-
bar: async fn (*i32) void,
6716+
bar: fn (*i32) callconv(.Async) void,
67176717
};
67186718
var foo = Foo{ .bar = func };
67196719
var bytes: [64]u8 align(@alignOf(@Frame(func))) = undefined;
@@ -6723,7 +6723,7 @@ test "async fn pointer in a struct field" {
67236723
assert(data == 4);
67246724
}
67256725

6726-
async fn func(y: *i32) void {
6726+
fn func(y: *i32) void {
67276727
defer y.* += 2;
67286728
y.* += 1;
67296729
suspend;

test/compile_errors.zig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
779779
});
780780

781781
cases.add("exported async function",
782-
\\export async fn foo() void {}
782+
\\export fn foo() callconv(.Async) void {}
783783
, &[_][]const u8{
784784
"tmp.zig:1:1: error: exported function cannot be async",
785785
});
@@ -1258,11 +1258,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
12581258

12591259
cases.add("bad alignment in @asyncCall",
12601260
\\export fn entry() void {
1261-
\\ var ptr: async fn () void = func;
1261+
\\ var ptr: fn () callconv(.Async) void = func;
12621262
\\ var bytes: [64]u8 = undefined;
12631263
\\ _ = @asyncCall(&bytes, {}, ptr);
12641264
\\}
1265-
\\async fn func() void {}
1265+
\\fn func() callconv(.Async) void {}
12661266
, &[_][]const u8{
12671267
"tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'",
12681268
});
@@ -1408,7 +1408,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14081408
\\export fn entry() void {
14091409
\\ _ = async amain();
14101410
\\}
1411-
\\async fn amain() void {
1411+
\\fn amain() callconv(.Async) void {
14121412
\\ other();
14131413
\\}
14141414
\\fn other() void {
@@ -1424,7 +1424,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14241424
\\export fn entry() void {
14251425
\\ _ = async amain();
14261426
\\}
1427-
\\async fn amain() void {
1427+
\\fn amain() callconv(.Async) void {
14281428
\\ var x: [@sizeOf(@Frame(amain))]u8 = undefined;
14291429
\\}
14301430
, &[_][]const u8{
@@ -1451,7 +1451,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14511451
\\ var ptr = afunc;
14521452
\\ _ = ptr();
14531453
\\}
1454-
\\async fn afunc() void {}
1454+
\\fn afunc() callconv(.Async) void {}
14551455
, &[_][]const u8{
14561456
"tmp.zig:6:12: error: function is not comptime-known; @asyncCall required",
14571457
});
@@ -1462,7 +1462,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14621462
\\ _ = async ptr();
14631463
\\}
14641464
\\
1465-
\\async fn afunc() void { }
1465+
\\fn afunc() callconv(.Async) void { }
14661466
, &[_][]const u8{
14671467
"tmp.zig:3:15: error: function is not comptime-known; @asyncCall required",
14681468
});
@@ -3051,7 +3051,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
30513051
\\export fn entry() void {
30523052
\\ _ = async foo();
30533053
\\}
3054-
\\async fn foo() void {
3054+
\\fn foo() void {
30553055
\\ suspend {
30563056
\\ suspend {
30573057
\\ }
@@ -3099,7 +3099,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
30993099
\\export fn entry() void {
31003100
\\ _ = async amain();
31013101
\\}
3102-
\\async fn amain() void {
3102+
\\fn amain() callconv(.Async) void {
31033103
\\ return error.ShouldBeCompileError;
31043104
\\}
31053105
, &[_][]const u8{
@@ -3569,7 +3569,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
35693569
});
35703570

35713571
cases.add("attempt to use 0 bit type in extern fn",
3572-
\\extern fn foo(ptr: extern fn(*void) void) void;
3572+
\\extern fn foo(ptr: fn(*void) callconv(.C) void) void;
35733573
\\
35743574
\\export fn entry() void {
35753575
\\ foo(bar);
@@ -3580,7 +3580,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
35803580
\\ bar(&{});
35813581
\\}
35823582
, &[_][]const u8{
3583-
"tmp.zig:1:30: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
3583+
"tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
35843584
"tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
35853585
});
35863586

test/runtime_safety.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
282282
\\ var ptr = other;
283283
\\ var frame = @asyncCall(&bytes, {}, ptr);
284284
\\}
285-
\\async fn other() void {
285+
\\fn other() callconv(.Async) void {
286286
\\ suspend;
287287
\\}
288288
);
@@ -874,16 +874,16 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
874874
\\ return &failing_frame;
875875
\\}
876876
\\
877-
\\async fn failing() anyerror!void {
877+
\\fn failing() anyerror!void {
878878
\\ suspend;
879879
\\ return second();
880880
\\}
881881
\\
882-
\\async fn second() anyerror!void {
882+
\\fn second() callconv(.Async) anyerror!void {
883883
\\ return error.Fail;
884884
\\}
885885
\\
886-
\\async fn printTrace(p: anyframe->anyerror!void) void {
886+
\\fn printTrace(p: anyframe->anyerror!void) void {
887887
\\ (await p) catch unreachable;
888888
\\}
889889
);

test/stack_traces.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
282282
\\source.zig:10:8: [address] in main (test)
283283
\\ foo();
284284
\\ ^
285-
\\start.zig:250:29: [address] in std.start.posixCallMainAndExit (test)
285+
\\start.zig:249:29: [address] in std.start.posixCallMainAndExit (test)
286286
\\ return root.main();
287287
\\ ^
288288
\\start.zig:123:5: [address] in std.start._start (test)

0 commit comments

Comments
 (0)