-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing async spill when returning a function call of async fn with error union return value #3190
Comments
This still seems to be happening. test "correctly spill when returning the error union result of another async fn" {
const S = struct {
const Self = @This();
term: ?(SpawnError!Term),
pub const SpawnError = error{OutOfMemory};
pub const Term = union(enum) {
Exited: u32,
Signal: u32,
Stopped: u32,
Unknown: u32,
};
var global_frame: anyframe = undefined;
fn doTheTest(self: *Self) void {
atest(self);
if ((self.term.? catch unreachable) != .Exited) unreachable;
}
fn atest(self: *Self) void {
self.term = fallible1(self);
}
fn fallible1(self: *Self) SpawnError!Term {
suspend {
global_frame = @frame();
}
return Term{.Exited = 0};
}
};
var s = S {.term = undefined};
_ = async s.doTheTest();
resume S.global_frame;
} Results in
|
Fixed by #4404 |
Landed in 014f66e |
Unrelated but this looks like dead code Line 113 in 49f3def
|
Yes and collapse those 2 lines back into 1.
I think dead code in errdefers are ok. They document resource cleanup that would need to happen if you added additional code after that line. |
Expected to pass. Actual output:
Related: #3157 (for the convenience of the test case)
The text was updated successfully, but these errors were encountered: