Commit 07d8740882

mlugg <mlugg@mlugg.co.uk>
2024-02-27 03:15:32
AstGen: do not generate defers at unreachable end of block
Resolves: #8822
1 parent f6abf02
Changed files (1)
lib
std
lib/std/zig/AstGen.zig
@@ -2563,7 +2563,9 @@ fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Nod
         }
     }
 
-    try genDefers(gz, parent_scope, scope, .normal_only);
+    if (noreturn_src_node == 0) {
+        try genDefers(gz, parent_scope, scope, .normal_only);
+    }
     try checkUsed(gz, parent_scope, scope);
 }