mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Allow resume in nosuspend scope
Resuming a suspended async function call is actually a synchronous operation. This commit removes the compiler code which generates the error and updates the relevant test case.
This commit is contained in:
parent
9270aae071
commit
c0cfbe98f3
2 changed files with 0 additions and 5 deletions
|
|
@ -10095,10 +10095,6 @@ static IrInstSrc *ir_gen_fn_proto(IrBuilderSrc *irb, Scope *parent_scope, AstNod
|
||||||
|
|
||||||
static IrInstSrc *ir_gen_resume(IrBuilderSrc *irb, Scope *scope, AstNode *node) {
|
static IrInstSrc *ir_gen_resume(IrBuilderSrc *irb, Scope *scope, AstNode *node) {
|
||||||
assert(node->type == NodeTypeResume);
|
assert(node->type == NodeTypeResume);
|
||||||
if (get_scope_nosuspend(scope) != nullptr) {
|
|
||||||
add_node_error(irb->codegen, node, buf_sprintf("resume in nosuspend scope"));
|
|
||||||
return irb->codegen->invalid_inst_src;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrInstSrc *target_inst = ir_gen_node_extra(irb, node->data.resume_expr.expr, scope, LValPtr, nullptr);
|
IrInstSrc *target_inst = ir_gen_node_extra(irb, node->data.resume_expr.expr, scope, LValPtr, nullptr);
|
||||||
if (target_inst == irb->codegen->invalid_inst_src)
|
if (target_inst == irb->codegen->invalid_inst_src)
|
||||||
|
|
|
||||||
|
|
@ -1029,7 +1029,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||||
, &[_][]const u8{
|
, &[_][]const u8{
|
||||||
"tmp.zig:3:21: error: async call in nosuspend scope",
|
"tmp.zig:3:21: error: async call in nosuspend scope",
|
||||||
"tmp.zig:4:9: error: suspend in nosuspend scope",
|
"tmp.zig:4:9: error: suspend in nosuspend scope",
|
||||||
"tmp.zig:5:9: error: resume in nosuspend scope",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cases.add("atomicrmw with bool op not .Xchg",
|
cases.add("atomicrmw with bool op not .Xchg",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue