diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-06-15 09:49:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-15 09:49:59 -0700 |
| commit | f5043ad6a3232dc5ce3cadcbf04c2ee038d34810 (patch) | |
| tree | 1c45bb6c99bd45a44f73b8d2ad1a1d42915601e2 /src/Sema.zig | |
| parent | 11d0dfb8829f7a247b21b417157bafeebd6a2a90 (diff) | |
| parent | 57f6e6729f74bc7f43848aff6cd52e89465cc49e (diff) | |
| download | zig-f5043ad6a3232dc5ce3cadcbf04c2ee038d34810.tar.gz zig-f5043ad6a3232dc5ce3cadcbf04c2ee038d34810.zip | |
Merge pull request #16042 from mlugg/fix/slice-len-comptime-mutation
Fix comptime mutation of slice len
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 28b75b56a6..c32df9e12a 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -10069,7 +10069,7 @@ fn zirSliceSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr const extra = sema.code.extraData(Zir.Inst.SliceSentinel, inst_data.payload_index).data; const array_ptr = try sema.resolveInst(extra.lhs); const start = try sema.resolveInst(extra.start); - const end = try sema.resolveInst(extra.end); + const end: Air.Inst.Ref = if (extra.end == .none) .none else try sema.resolveInst(extra.end); const sentinel = try sema.resolveInst(extra.sentinel); const ptr_src: LazySrcLoc = .{ .node_offset_slice_ptr = inst_data.src_node }; const start_src: LazySrcLoc = .{ .node_offset_slice_start = inst_data.src_node }; @@ -29280,7 +29280,7 @@ fn beginComptimePtrLoad( }, Value.slice_len_index => TypedValue{ .ty = Type.usize, - .val = mod.intern_pool.indexToKey(tv.val.toIntern()).ptr.len.toValue(), + .val = mod.intern_pool.indexToKey(try tv.val.intern(tv.ty, mod)).ptr.len.toValue(), }, else => unreachable, }; |
