| ... | ... | @@ -82,6 +82,8 @@ is_generic_instantiation: bool = false, |
| 82 | 82 | /// function types will emit generic poison instead of a partial type. |
| 83 | 83 | no_partial_func_ty: bool = false, |
| 84 | 84 | |
| 85 | unresolved_inferred_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, |
| 86 | |
| 85 | 87 | const std = @import("std"); |
| 86 | 88 | const math = std.math; |
| 87 | 89 | const mem = std.mem; |
| ... | ... | @@ -579,6 +581,7 @@ pub fn deinit(sema: *Sema) void { |
| 579 | 581 | } |
| 580 | 582 | sema.post_hoc_blocks.deinit(gpa); |
| 581 | 583 | } |
| 584 | sema.unresolved_inferred_allocs.deinit(gpa); |
| 582 | 585 | sema.* = undefined; |
| 583 | 586 | } |
| 584 | 587 | |
| ... | ... | @@ -3238,6 +3241,7 @@ fn zirAllocExtended( |
| 3238 | 3241 | ); |
| 3239 | 3242 | try sema.requireFunctionBlock(block, src); |
| 3240 | 3243 | try block.instructions.append(sema.gpa, Air.refToIndex(result).?); |
| 3244 | try sema.unresolved_inferred_allocs.putNoClobber(sema.gpa, Air.refToIndex(result).?, {}); |
| 3241 | 3245 | return result; |
| 3242 | 3246 | } |
| 3243 | 3247 | |
| ... | ... | @@ -3414,6 +3418,7 @@ fn zirAllocInferred( |
| 3414 | 3418 | ); |
| 3415 | 3419 | try sema.requireFunctionBlock(block, src); |
| 3416 | 3420 | try block.instructions.append(sema.gpa, Air.refToIndex(result).?); |
| 3421 | try sema.unresolved_inferred_allocs.putNoClobber(sema.gpa, Air.refToIndex(result).?, {}); |
| 3417 | 3422 | return result; |
| 3418 | 3423 | } |
| 3419 | 3424 | |
| ... | ... | @@ -3463,6 +3468,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3463 | 3468 | } |
| 3464 | 3469 | }, |
| 3465 | 3470 | .inferred_alloc => { |
| 3471 | assert(sema.unresolved_inferred_allocs.remove(ptr_inst)); |
| 3466 | 3472 | const inferred_alloc = ptr_val.castTag(.inferred_alloc).?; |
| 3467 | 3473 | const peer_inst_list = inferred_alloc.data.prongs.items(.stored_inst); |
| 3468 | 3474 | const final_elem_ty = try sema.resolvePeerTypes(block, ty_src, peer_inst_list, .none); |