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
signaturelock-open 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;
67136713test "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
6726async fn func(y: *i32) void {
6726fn func(y: *i32) void {
67276727 defer y.* += 2;
67286728 y.* += 1;
67296729 suspend;
lib/std/zig/parser_test.zig+1
......@@ -2910,6 +2910,7 @@ test "zig fmt: noasync to nosuspend" {
29102910 \\pub fn main() void {
29112911 \\ nosuspend call();
29122912 \\}
2913 \\
29132914 );
29142915}
29152916
test/compile_errors.zig+11-11
......@@ -802,7 +802,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
802802 });
803803
804804 cases.add("exported async function",
805 \\export async fn foo() void {}
805 \\export fn foo() callconv(.Async) void {}
806806 , &[_][]const u8{
807807 "tmp.zig:1:1: error: exported function cannot be async",
808808 });
......@@ -1281,11 +1281,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
12811281
12821282 cases.add("bad alignment in @asyncCall",
12831283 \\export fn entry() void {
1284 \\ var ptr: async fn () void = func;
1284 \\ var ptr: fn () callconv(.Async) void = func;
12851285 \\ var bytes: [64]u8 = undefined;
12861286 \\ _ = @asyncCall(&bytes, {}, ptr);
12871287 \\}
1288 \\async fn func() void {}
1288 \\fn func() callconv(.Async) void {}
12891289 , &[_][]const u8{
12901290 "tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'",
12911291 });
......@@ -1431,7 +1431,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14311431 \\export fn entry() void {
14321432 \\ _ = async amain();
14331433 \\}
1434 \\async fn amain() void {
1434 \\fn amain() callconv(.Async) void {
14351435 \\ other();
14361436 \\}
14371437 \\fn other() void {
......@@ -1447,7 +1447,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14471447 \\export fn entry() void {
14481448 \\ _ = async amain();
14491449 \\}
1450 \\async fn amain() void {
1450 \\fn amain() callconv(.Async) void {
14511451 \\ var x: [@sizeOf(@Frame(amain))]u8 = undefined;
14521452 \\}
14531453 , &[_][]const u8{
......@@ -1474,7 +1474,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14741474 \\ var ptr = afunc;
14751475 \\ _ = ptr();
14761476 \\}
1477 \\async fn afunc() void {}
1477 \\fn afunc() callconv(.Async) void {}
14781478 , &[_][]const u8{
14791479 "tmp.zig:6:12: error: function is not comptime-known; @asyncCall required",
14801480 });
......@@ -1485,7 +1485,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
14851485 \\ _ = async ptr();
14861486 \\}
14871487 \\
1488 \\async fn afunc() void { }
1488 \\fn afunc() callconv(.Async) void { }
14891489 , &[_][]const u8{
14901490 "tmp.zig:3:15: error: function is not comptime-known; @asyncCall required",
14911491 });
......@@ -3074,7 +3074,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
30743074 \\export fn entry() void {
30753075 \\ _ = async foo();
30763076 \\}
3077 \\async fn foo() void {
3077 \\fn foo() void {
30783078 \\ suspend {
30793079 \\ suspend {
30803080 \\ }
......@@ -3122,7 +3122,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
31223122 \\export fn entry() void {
31233123 \\ _ = async amain();
31243124 \\}
3125 \\async fn amain() void {
3125 \\fn amain() callconv(.Async) void {
31263126 \\ return error.ShouldBeCompileError;
31273127 \\}
31283128 , &[_][]const u8{
......@@ -3592,7 +3592,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
35923592 });
35933593
35943594 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;
35963596 \\
35973597 \\export fn entry() void {
35983598 \\ foo(bar);
......@@ -3603,7 +3603,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
36033603 \\ bar(&{});
36043604 \\}
36053605 , &[_][]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'",
36073607 "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
36083608 });
36093609
test/runtime_safety.zig+4-4
......@@ -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+1-1
......@@ -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)