You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
conststd=@import("std");
constexpect=std.testing.expect;
varx: i32=1;
test"suspend with no resume" {
varframe=asyncfunc();
tryexpect(x==2);
_=frame;
}
fnfunc() void {
x+=1;
suspend {}
// This line is never reached because the suspend has no matching resume.x+=1;
}
It fails to compile under zig test --test-evented-io:
$ zig test --test-evented-io main.zig
/Users/slimsag/Desktop/hexops/zig/build/lib/zig/std/special/test_runner.zig:59:42: error: expected type 'void', found 'std.mem.Allocator.Error'
async_frame_buffer = try std.heap.page_allocator.alignedAlloc(u8, std.Target.stack_align, size);
^
/Users/slimsag/Desktop/hexops/zig/build/lib/zig/std/special/test_runner.zig:19:15: note: function cannot return an error
pub fn main() void {
^
The text was updated successfully, but these errors were encountered:
Investigating hexops/zorex#4, I found that `--test-evented-io` is currently broken in
the latest Zig nightly. See ziglang#9779 for a small reproduction.
The issue is that allocation errors here are not correctly handled, as this function
returns `void` and all other error cases `@panic`, the allocation failure should also
use `@panic`.
Fixesziglang#9779
Helps hexops/zorex#4
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Investigating hexops/zorex#4, I found that `--test-evented-io` is currently broken in
the latest Zig nightly. See #9779 for a small reproduction.
The issue is that allocation errors here are not correctly handled, as this function
returns `void` and all other error cases `@panic`, the allocation failure should also
use `@panic`.
Fixes#9779
Helps hexops/zorex#4
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
With a basic async example:
It fails to compile under
zig test --test-evented-io
:The text was updated successfully, but these errors were encountered: