| ... | ... | @@ -3123,10 +3123,10 @@ fn varDecl( |
| 3123 | 3123 | if (nodeMayAppendToErrorTrace(tree, var_decl.ast.init_node)) |
| 3124 | 3124 | _ = try gz.addSaveErrRetIndex(.{ .if_of_error_type = init_inst }); |
| 3125 | 3125 | |
| 3126 | | if (resolve_inferred_alloc != .none) { |
| 3126 | const const_ptr = if (resolve_inferred_alloc != .none) p: { |
| 3127 | 3127 | _ = try gz.addUnNode(.resolve_inferred_alloc, resolve_inferred_alloc, node); |
| 3128 | | } |
| 3129 | | const const_ptr = try gz.addUnNode(.make_ptr_const, var_ptr, node); |
| 3128 | break :p var_ptr; |
| 3129 | } else try gz.addUnNode(.make_ptr_const, var_ptr, node); |
| 3130 | 3130 | |
| 3131 | 3131 | try gz.addDbgVar(.dbg_var_ptr, ident_name, const_ptr); |
| 3132 | 3132 | |
| ... | ... | @@ -3533,7 +3533,9 @@ fn assignDestructureMaybeDecls( |
| 3533 | 3533 | else => unreachable, |
| 3534 | 3534 | }; |
| 3535 | 3535 | // If the alloc was const, make it const. |
| 3536 | | const var_ptr = if (is_const) make_const: { |
| 3536 | const var_ptr = if (is_const and full.ast.type_node != 0) make_const: { |
| 3537 | // Note that we don't do this if type_node == 0 since `resolve_inferred_alloc` |
| 3538 | // handles it for us. |
| 3537 | 3539 | break :make_const try gz.addUnNode(.make_ptr_const, raw_ptr, node); |
| 3538 | 3540 | } else raw_ptr; |
| 3539 | 3541 | const name_token = full.ast.mut_token + 1; |