authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-04 10:50:11-06:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 10:31:32-06:00
log84a0a9688caea0f7cfe19bac07d5b5d46a06d470
treecd3bee22f4f6880229ab5eb9055a2157af2a1592
parent6745a6f6f6f2b8d4473f00bed03a6cf1af117890
signature Commit is signed but in an unrecognized format.

update docs/tests for async/extern fn removal


5 files changed, 19 insertions(+), 18 deletions(-)

doc/langref.html.in+2-2
...@@ -6713,7 +6713,7 @@ const assert = std.debug.assert;...@@ -6713,7 +6713,7 @@ const assert = std.debug.assert;
6713test "async fn pointer in a struct field" {6713test "async fn pointer in a struct field" {
6714 var data: i32 = 1;6714 var data: i32 = 1;
6715 const Foo = struct {6715 const Foo = struct {
6716 bar: async fn (*i32) void,6716 bar: fn (*i32) callconv(.Async) void,
6717 };6717 };
6718 var foo = Foo{ .bar = func };6718 var foo = Foo{ .bar = func };
6719 var bytes: [64]u8 align(@alignOf(@Frame(func))) = undefined;6719 var bytes: [64]u8 align(@alignOf(@Frame(func))) = undefined;
...@@ -6723,7 +6723,7 @@ test "async fn pointer in a struct field" {...@@ -6723,7 +6723,7 @@ test "async fn pointer in a struct field" {
6723 assert(data == 4);6723 assert(data == 4);
6724}6724}
67256725
6726async fn func(y: *i32) void {6726fn func(y: *i32) void {
6727 defer y.* += 2;6727 defer y.* += 2;
6728 y.* += 1;6728 y.* += 1;
6729 suspend;6729 suspend;
lib/std/zig/parser_test.zig+1
...@@ -2910,6 +2910,7 @@ test "zig fmt: noasync to nosuspend" {...@@ -2910,6 +2910,7 @@ test "zig fmt: noasync to nosuspend" {
2910 \\pub fn main() void {2910 \\pub fn main() void {
2911 \\ nosuspend call();2911 \\ nosuspend call();
2912 \\}2912 \\}
2913 \\
2913 );2914 );
2914}2915}
29152916
test/compile_errors.zig+11-11
...@@ -802,7 +802,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -802,7 +802,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
802 });802 });
803803
804 cases.add("exported async function",804 cases.add("exported async function",
805 \\export async fn foo() void {}805 \\export fn foo() callconv(.Async) void {}
806 , &[_][]const u8{806 , &[_][]const u8{
807 "tmp.zig:1:1: error: exported function cannot be async",807 "tmp.zig:1:1: error: exported function cannot be async",
808 });808 });
...@@ -1281,11 +1281,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -1281,11 +1281,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
12811281
1282 cases.add("bad alignment in @asyncCall",1282 cases.add("bad alignment in @asyncCall",
1283 \\export fn entry() void {1283 \\export fn entry() void {
1284 \\ var ptr: async fn () void = func;1284 \\ var ptr: fn () callconv(.Async) void = func;
1285 \\ var bytes: [64]u8 = undefined;1285 \\ var bytes: [64]u8 = undefined;
1286 \\ _ = @asyncCall(&bytes, {}, ptr);1286 \\ _ = @asyncCall(&bytes, {}, ptr);
1287 \\}1287 \\}
1288 \\async fn func() void {}1288 \\fn func() callconv(.Async) void {}
1289 , &[_][]const u8{1289 , &[_][]const u8{
1290 "tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'",1290 "tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'",
1291 });1291 });
...@@ -1431,7 +1431,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -1431,7 +1431,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
1431 \\export fn entry() void {1431 \\export fn entry() void {
1432 \\ _ = async amain();1432 \\ _ = async amain();
1433 \\}1433 \\}
1434 \\async fn amain() void {1434 \\fn amain() callconv(.Async) void {
1435 \\ other();1435 \\ other();
1436 \\}1436 \\}
1437 \\fn other() void {1437 \\fn other() void {
...@@ -1447,7 +1447,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -1447,7 +1447,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
1447 \\export fn entry() void {1447 \\export fn entry() void {
1448 \\ _ = async amain();1448 \\ _ = async amain();
1449 \\}1449 \\}
1450 \\async fn amain() void {1450 \\fn amain() callconv(.Async) void {
1451 \\ var x: [@sizeOf(@Frame(amain))]u8 = undefined;1451 \\ var x: [@sizeOf(@Frame(amain))]u8 = undefined;
1452 \\}1452 \\}
1453 , &[_][]const u8{1453 , &[_][]const u8{
...@@ -1474,7 +1474,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -1474,7 +1474,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
1474 \\ var ptr = afunc;1474 \\ var ptr = afunc;
1475 \\ _ = ptr();1475 \\ _ = ptr();
1476 \\}1476 \\}
1477 \\async fn afunc() void {}1477 \\fn afunc() callconv(.Async) void {}
1478 , &[_][]const u8{1478 , &[_][]const u8{
1479 "tmp.zig:6:12: error: function is not comptime-known; @asyncCall required",1479 "tmp.zig:6:12: error: function is not comptime-known; @asyncCall required",
1480 });1480 });
...@@ -1485,7 +1485,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -1485,7 +1485,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
1485 \\ _ = async ptr();1485 \\ _ = async ptr();
1486 \\}1486 \\}
1487 \\1487 \\
1488 \\async fn afunc() void { }1488 \\fn afunc() callconv(.Async) void { }
1489 , &[_][]const u8{1489 , &[_][]const u8{
1490 "tmp.zig:3:15: error: function is not comptime-known; @asyncCall required",1490 "tmp.zig:3:15: error: function is not comptime-known; @asyncCall required",
1491 });1491 });
...@@ -3074,7 +3074,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -3074,7 +3074,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
3074 \\export fn entry() void {3074 \\export fn entry() void {
3075 \\ _ = async foo();3075 \\ _ = async foo();
3076 \\}3076 \\}
3077 \\async fn foo() void {3077 \\fn foo() void {
3078 \\ suspend {3078 \\ suspend {
3079 \\ suspend {3079 \\ suspend {
3080 \\ }3080 \\ }
...@@ -3122,7 +3122,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -3122,7 +3122,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
3122 \\export fn entry() void {3122 \\export fn entry() void {
3123 \\ _ = async amain();3123 \\ _ = async amain();
3124 \\}3124 \\}
3125 \\async fn amain() void {3125 \\fn amain() callconv(.Async) void {
3126 \\ return error.ShouldBeCompileError;3126 \\ return error.ShouldBeCompileError;
3127 \\}3127 \\}
3128 , &[_][]const u8{3128 , &[_][]const u8{
...@@ -3592,7 +3592,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -3592,7 +3592,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
3592 });3592 });
35933593
3594 cases.add("attempt to use 0 bit type in extern fn",3594 cases.add("attempt to use 0 bit type in extern fn",
3595 \\extern fn foo(ptr: extern fn(*void) void) void;3595 \\extern fn foo(ptr: fn(*void) callconv(.C) void) void;
3596 \\3596 \\
3597 \\export fn entry() void {3597 \\export fn entry() void {
3598 \\ foo(bar);3598 \\ foo(bar);
...@@ -3603,7 +3603,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -3603,7 +3603,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
3603 \\ bar(&{});3603 \\ bar(&{});
3604 \\}3604 \\}
3605 , &[_][]const u8{3605 , &[_][]const u8{
3606 "tmp.zig:1:30: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",3606 "tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
3607 "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",3607 "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
3608 });3608 });
36093609
test/runtime_safety.zig+4-4
...@@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
282 \\ var ptr = other;282 \\ var ptr = other;
283 \\ var frame = @asyncCall(&bytes, {}, ptr);283 \\ var frame = @asyncCall(&bytes, {}, ptr);
284 \\}284 \\}
285 \\async fn other() void {285 \\fn other() callconv(.Async) void {
286 \\ suspend;286 \\ suspend;
287 \\}287 \\}
288 );288 );
...@@ -874,16 +874,16 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -874,16 +874,16 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
874 \\ return &failing_frame;874 \\ return &failing_frame;
875 \\}875 \\}
876 \\876 \\
877 \\async fn failing() anyerror!void {877 \\fn failing() anyerror!void {
878 \\ suspend;878 \\ suspend;
879 \\ return second();879 \\ return second();
880 \\}880 \\}
881 \\881 \\
882 \\async fn second() anyerror!void {882 \\fn second() callconv(.Async) anyerror!void {
883 \\ return error.Fail;883 \\ return error.Fail;
884 \\}884 \\}
885 \\885 \\
886 \\async fn printTrace(p: anyframe->anyerror!void) void {886 \\fn printTrace(p: anyframe->anyerror!void) void {
887 \\ (await p) catch unreachable;887 \\ (await p) catch unreachable;
888 \\}888 \\}
889 );889 );
test/stack_traces.zig+1-1
...@@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
282 \\source.zig:10:8: [address] in main (test)282 \\source.zig:10:8: [address] in main (test)
283 \\ foo();283 \\ foo();
284 \\ ^284 \\ ^
285 \\start.zig:250:29: [address] in std.start.posixCallMainAndExit (test)285 \\start.zig:249:29: [address] in std.start.posixCallMainAndExit (test)
286 \\ return root.main();286 \\ return root.main();
287 \\ ^287 \\ ^
288 \\start.zig:123:5: [address] in std.start._start (test)288 \\start.zig:123:5: [address] in std.start._start (test)