std.Thread: fix mutable ref of temporary

The previous code is a compile error in stage2 as well as the
upcoming lang spec.
This commit is contained in:
Andrew Kelley 2022-07-04 16:53:41 -07:00
parent 9ecc47cd7c
commit afe6e69e4c

View File

@ -513,7 +513,8 @@ const WindowsThreadImpl = struct {
errdefer assert(windows.kernel32.HeapFree(heap_handle, 0, alloc_ptr) != 0);
const instance_bytes = @ptrCast([*]u8, alloc_ptr)[0..alloc_bytes];
const instance = std.heap.FixedBufferAllocator.init(instance_bytes).allocator().create(Instance) catch unreachable;
var fba = std.heap.FixedBufferAllocator.init(instance_bytes);
const instance = fba.allocator().create(Instance) catch unreachable;
instance.* = .{
.fn_args = args,
.thread = .{