authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-06-26 18:49:38-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-27 00:46:31-07:00
logd881d841ed85808e59c20db6a25b019ab2e019f8
tree52fc6bd12d86df7a1fa3c2f787f7c112e7752ea9
parentd9e867172e85270d479fc1b00f42648bc0ca0179

Sema: use tmp_hack_arena as a temporary solution for lifetime issues

All of this code is expected to get rewritten anyway. Closes #16216

1 files changed, 5 insertions(+), 5 deletions(-)

src/Sema.zig+5-5
...@@ -28885,7 +28885,7 @@ fn beginComptimePtrMutation(...@@ -28885,7 +28885,7 @@ fn beginComptimePtrMutation(
28885 // If we wanted to avoid this, there would need to be special detection28885 // If we wanted to avoid this, there would need to be special detection
28886 // elsewhere to identify when writing a value to an array element that is stored28886 // elsewhere to identify when writing a value to an array element that is stored
28887 // using the `bytes` tag, and handle it without making a call to this function.28887 // using the `bytes` tag, and handle it without making a call to this function.
28888 const arena = sema.arena;28888 const arena = mod.tmp_hack_arena.allocator();
2888928889
28890 const bytes = val_ptr.castTag(.bytes).?.data;28890 const bytes = val_ptr.castTag(.bytes).?.data;
28891 const dest_len = parent.ty.arrayLenIncludingSentinel(mod);28891 const dest_len = parent.ty.arrayLenIncludingSentinel(mod);
...@@ -28917,7 +28917,7 @@ fn beginComptimePtrMutation(...@@ -28917,7 +28917,7 @@ fn beginComptimePtrMutation(
28917 // need to be special detection elsewhere to identify when writing a value to an28917 // need to be special detection elsewhere to identify when writing a value to an
28918 // array element that is stored using the `repeated` tag, and handle it28918 // array element that is stored using the `repeated` tag, and handle it
28919 // without making a call to this function.28919 // without making a call to this function.
28920 const arena = sema.arena;28920 const arena = mod.tmp_hack_arena.allocator();
2892128921
28922 const repeated_val = try val_ptr.castTag(.repeated).?.data.intern(parent.ty.childType(mod), mod);28922 const repeated_val = try val_ptr.castTag(.repeated).?.data.intern(parent.ty.childType(mod), mod);
28923 const array_len_including_sentinel =28923 const array_len_including_sentinel =
...@@ -28955,7 +28955,7 @@ fn beginComptimePtrMutation(...@@ -28955,7 +28955,7 @@ fn beginComptimePtrMutation(
28955 // An array has been initialized to undefined at comptime and now we28955 // An array has been initialized to undefined at comptime and now we
28956 // are for the first time setting an element. We must change the representation28956 // are for the first time setting an element. We must change the representation
28957 // of the array from `undef` to `array`.28957 // of the array from `undef` to `array`.
28958 const arena = sema.arena;28958 const arena = mod.tmp_hack_arena.allocator();
2895928959
28960 const array_len_including_sentinel =28960 const array_len_including_sentinel =
28961 try sema.usizeCast(block, src, parent.ty.arrayLenIncludingSentinel(mod));28961 try sema.usizeCast(block, src, parent.ty.arrayLenIncludingSentinel(mod));
...@@ -29053,7 +29053,7 @@ fn beginComptimePtrMutation(...@@ -29053,7 +29053,7 @@ fn beginComptimePtrMutation(
29053 parent.mut_decl,29053 parent.mut_decl,
29054 ),29054 ),
29055 .repeated => {29055 .repeated => {
29056 const arena = sema.arena;29056 const arena = mod.tmp_hack_arena.allocator();
2905729057
29058 const elems = try arena.alloc(Value, parent.ty.structFieldCount(mod));29058 const elems = try arena.alloc(Value, parent.ty.structFieldCount(mod));
29059 @memset(elems, val_ptr.castTag(.repeated).?.data);29059 @memset(elems, val_ptr.castTag(.repeated).?.data);
...@@ -29116,7 +29116,7 @@ fn beginComptimePtrMutation(...@@ -29116,7 +29116,7 @@ fn beginComptimePtrMutation(
29116 // A struct or union has been initialized to undefined at comptime and now we29116 // A struct or union has been initialized to undefined at comptime and now we
29117 // are for the first time setting a field. We must change the representation29117 // are for the first time setting a field. We must change the representation
29118 // of the struct/union from `undef` to `struct`/`union`.29118 // of the struct/union from `undef` to `struct`/`union`.
29119 const arena = sema.arena;29119 const arena = mod.tmp_hack_arena.allocator();
2912029120
29121 switch (parent.ty.zigTypeTag(mod)) {29121 switch (parent.ty.zigTypeTag(mod)) {
29122 .Struct => {29122 .Struct => {