authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-04 16:53:41-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-04 16:53:41-07:00
logafe6e69e4cda8f5c3a11eed31015a28b1373ff20
tree9f672b1c99034b36ed059902180f1ac19a412678
parent9ecc47cd7cd5b5fbda8dc78a5d2ab41d8f0d01a8

std.Thread: fix mutable ref of temporary

The previous code is a compile error in stage2 as well as the upcoming lang spec.

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

lib/std/Thread.zig+2-1
...@@ -513,7 +513,8 @@ const WindowsThreadImpl = struct {...@@ -513,7 +513,8 @@ const WindowsThreadImpl = struct {
513 errdefer assert(windows.kernel32.HeapFree(heap_handle, 0, alloc_ptr) != 0);513 errdefer assert(windows.kernel32.HeapFree(heap_handle, 0, alloc_ptr) != 0);
514514
515 const instance_bytes = @ptrCast([*]u8, alloc_ptr)[0..alloc_bytes];515 const instance_bytes = @ptrCast([*]u8, alloc_ptr)[0..alloc_bytes];
516 const instance = std.heap.FixedBufferAllocator.init(instance_bytes).allocator().create(Instance) catch unreachable;516 var fba = std.heap.FixedBufferAllocator.init(instance_bytes);
517 const instance = fba.allocator().create(Instance) catch unreachable;
517 instance.* = .{518 instance.* = .{
518 .fn_args = args,519 .fn_args = args,
519 .thread = .{520 .thread = .{