Sema: make inferred allocs always mutable
Const allocs don't make any sense, make_ptr_const handles making the pointers not mutable.
This commit is contained in:
@@ -3639,7 +3639,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
|
||||
const final_elem_ty = try decl.ty.copy(sema.arena);
|
||||
const final_ptr_ty = try Type.ptr(sema.arena, sema.mod, .{
|
||||
.pointee_type = final_elem_ty,
|
||||
.mutable = var_is_mut,
|
||||
.mutable = true,
|
||||
.@"align" = iac.data.alignment,
|
||||
.@"addrspace" = target_util.defaultAddressSpace(target, .local),
|
||||
});
|
||||
@@ -3663,7 +3663,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
|
||||
|
||||
const final_ptr_ty = try Type.ptr(sema.arena, sema.mod, .{
|
||||
.pointee_type = final_elem_ty,
|
||||
.mutable = var_is_mut,
|
||||
.mutable = true,
|
||||
.@"align" = inferred_alloc.data.alignment,
|
||||
.@"addrspace" = target_util.defaultAddressSpace(target, .local),
|
||||
});
|
||||
|
||||
@@ -133,7 +133,6 @@ test "if-else expression with runtime condition result location is inferred opti
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const A = struct { b: u64, c: u64 };
|
||||
var d: bool = true;
|
||||
|
||||
Reference in New Issue
Block a user