Sema: use tmp_hack_arena as a temporary solution for lifetime issues
All of this code is expected to get rewritten anyway. Closes #16216
This commit is contained in:
committed by
Andrew Kelley
parent
d9e867172e
commit
d881d841ed
10
src/Sema.zig
10
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 => {
|
||||
|
||||
Reference in New Issue
Block a user