| ... | @@ -29933,7 +29933,7 @@ fn storePtr2( | ... | @@ -29933,7 +29933,7 @@ fn storePtr2( |
| 29933 | // We're performing the store at runtime, so the pointee type must not be comptime-only. | 29933 | // We're performing the store at runtime, so the pointee type must not be comptime-only. |
| 29934 | if (comptime_only) return sema.failWithOwnedErrorMsg(block, msg: { | 29934 | if (comptime_only) return sema.failWithOwnedErrorMsg(block, msg: { |
| 29935 | const msg = try sema.errMsg(src, "cannot store comptime-only type '{f}' at runtime", .{elem_ty.fmt(pt)}); | 29935 | const msg = try sema.errMsg(src, "cannot store comptime-only type '{f}' at runtime", .{elem_ty.fmt(pt)}); |
| 29936 | errdefer msg.destroy(sema.gpa); | 29936 | errdefer msg.destroy(zcu.gpa); |
| 29937 | try sema.errNote(ptr_src, msg, "operation is runtime due to this pointer", .{}); | 29937 | try sema.errNote(ptr_src, msg, "operation is runtime due to this pointer", .{}); |
| 29938 | break :msg msg; | 29938 | break :msg msg; |
| 29939 | }); | 29939 | }); |
| ... | @@ -29957,10 +29957,18 @@ fn storePtr2( | ... | @@ -29957,10 +29957,18 @@ fn storePtr2( |
| 29957 | fn checkComptimeKnownStore(sema: *Sema, block: *Block, store_inst_ref: Air.Inst.Ref, store_src: LazySrcLoc) !void { | 29957 | fn checkComptimeKnownStore(sema: *Sema, block: *Block, store_inst_ref: Air.Inst.Ref, store_src: LazySrcLoc) !void { |
| 29958 | const store_inst = store_inst_ref.toIndex().?; | 29958 | const store_inst = store_inst_ref.toIndex().?; |
| 29959 | const inst_data = sema.air_instructions.items(.data)[@backingInt(store_inst)].bin_op; | 29959 | const inst_data = sema.air_instructions.items(.data)[@backingInt(store_inst)].bin_op; |
| 29960 | const ptr = inst_data.lhs.toIndex() orelse return; | | |
| 29961 | const operand = inst_data.rhs; | 29960 | const operand = inst_data.rhs; |
| 29962 | | 29961 | |
| 29963 | known: { | 29962 | known: { |
| | 29963 | const ptr = inst_data.lhs.toIndex() orelse { |
| | 29964 | const ptr_val: Value = .fromInterned(inst_data.lhs.toInterned().?); |
| | 29965 | if (sema.isComptimeMutablePtr(ptr_val)) { |
| | 29966 | return; |
| | 29967 | } else { |
| | 29968 | break :known; |
| | 29969 | } |
| | 29970 | }; |
| | 29971 | |
| 29964 | const maybe_base_alloc = sema.base_allocs.get(ptr) orelse break :known; | 29972 | const maybe_base_alloc = sema.base_allocs.get(ptr) orelse break :known; |
| 29965 | const maybe_comptime_alloc = sema.maybe_comptime_allocs.getPtr(maybe_base_alloc) orelse break :known; | 29973 | const maybe_comptime_alloc = sema.maybe_comptime_allocs.getPtr(maybe_base_alloc) orelse break :known; |
| 29966 | | 29974 | |