| ... | ... | @@ -3367,6 +3367,8 @@ pub fn deinit(mod: *Module) void { |
| 3367 | 3367 | for (mod.import_table.keys()) |key| { |
| 3368 | 3368 | gpa.free(key); |
| 3369 | 3369 | } |
| 3370 | var failed_decls = mod.failed_decls; |
| 3371 | mod.failed_decls = .{}; |
| 3370 | 3372 | for (mod.import_table.values()) |value| { |
| 3371 | 3373 | value.destroy(mod); |
| 3372 | 3374 | } |
| ... | ... | @@ -3406,10 +3408,10 @@ pub fn deinit(mod: *Module) void { |
| 3406 | 3408 | mod.local_zir_cache.handle.close(); |
| 3407 | 3409 | mod.global_zir_cache.handle.close(); |
| 3408 | 3410 | |
| 3409 | | for (mod.failed_decls.values()) |value| { |
| 3411 | for (failed_decls.values()) |value| { |
| 3410 | 3412 | value.destroy(gpa); |
| 3411 | 3413 | } |
| 3412 | | mod.failed_decls.deinit(gpa); |
| 3414 | failed_decls.deinit(gpa); |
| 3413 | 3415 | |
| 3414 | 3416 | if (mod.emit_h) |emit_h| { |
| 3415 | 3417 | for (emit_h.failed_decls.values()) |value| { |
| ... | ... | @@ -3482,6 +3484,13 @@ pub fn deinit(mod: *Module) void { |
| 3482 | 3484 | pub fn destroyDecl(mod: *Module, decl_index: Decl.Index) void { |
| 3483 | 3485 | const gpa = mod.gpa; |
| 3484 | 3486 | { |
| 3487 | if (mod.failed_decls.contains(decl_index)) { |
| 3488 | blk: { |
| 3489 | const errs = mod.comp.getAllErrorsAlloc() catch break :blk; |
| 3490 | for (errs.list) |err| Compilation.AllErrors.Message.renderToStdErr(err, .no_color); |
| 3491 | } |
| 3492 | @panic("Zig compiler bug: attempted to destroy declaration with an attached error"); |
| 3493 | } |
| 3485 | 3494 | const decl = mod.declPtr(decl_index); |
| 3486 | 3495 | log.debug("destroy {*} ({s})", .{ decl, decl.name }); |
| 3487 | 3496 | _ = mod.test_functions.swapRemove(decl_index); |