zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d881d841ed85808e59c20db6a25b019ab2e019f8 (tree)
parent d9e867172e85270d479fc1b00f42648bc0ca0179
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date:   Mon, 26 Jun 2023 18:49:38 -0400

Sema: use tmp_hack_arena as a temporary solution for lifetime issues

All of this code is expected to get rewritten anyway.

Closes #16216

Diffstat:
Msrc/Sema.zig | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Sema.zig b/src/Sema.zig @@ -28885,7 +28885,7 @@ fn beginComptimePtrMutation( // If we wanted to avoid this, there would need to be special detection // elsewhere to identify when writing a value to an array element that is stored // using the `bytes` tag, and handle it without making a call to this function. - const arena = sema.arena; + const arena = mod.tmp_hack_arena.allocator(); const bytes = val_ptr.castTag(.bytes).?.data; const dest_len = parent.ty.arrayLenIncludingSentinel(mod); @@ -28917,7 +28917,7 @@ fn beginComptimePtrMutation( // need to be special detection elsewhere to identify when writing a value to an // array element that is stored using the `repeated` tag, and handle it // without making a call to this function. - const arena = sema.arena; + const arena = mod.tmp_hack_arena.allocator(); const repeated_val = try val_ptr.castTag(.repeated).?.data.intern(parent.ty.childType(mod), mod); const array_len_including_sentinel = @@ -28955,7 +28955,7 @@ fn beginComptimePtrMutation( // An array has been initialized to undefined at comptime and now we // are for the first time setting an element. We must change the representation // of the array from `undef` to `array`. - const arena = sema.arena; + const arena = mod.tmp_hack_arena.allocator(); const array_len_including_sentinel = try sema.usizeCast(block, src, parent.ty.arrayLenIncludingSentinel(mod)); @@ -29053,7 +29053,7 @@ fn beginComptimePtrMutation( parent.mut_decl, ), .repeated => { - const arena = sema.arena; + const arena = mod.tmp_hack_arena.allocator(); const elems = try arena.alloc(Value, parent.ty.structFieldCount(mod)); @memset(elems, val_ptr.castTag(.repeated).?.data); @@ -29116,7 +29116,7 @@ fn beginComptimePtrMutation( // A struct or union has been initialized to undefined at comptime and now we // are for the first time setting a field. We must change the representation // of the struct/union from `undef` to `struct`/`union`. - const arena = sema.arena; + const arena = mod.tmp_hack_arena.allocator(); switch (parent.ty.zigTypeTag(mod)) { .Struct => {