aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-04 16:53:41 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-04 16:53:41 -0700
commitafe6e69e4cda8f5c3a11eed31015a28b1373ff20 (patch)
tree9f672b1c99034b36ed059902180f1ac19a412678 /lib/std/Thread.zig
parent9ecc47cd7cd5b5fbda8dc78a5d2ab41d8f0d01a8 (diff)
downloadzig-afe6e69e4cda8f5c3a11eed31015a28b1373ff20.tar.gz
zig-afe6e69e4cda8f5c3a11eed31015a28b1373ff20.zip
std.Thread: fix mutable ref of temporary
The previous code is a compile error in stage2 as well as the upcoming lang spec.
Diffstat (limited to 'lib/std/Thread.zig')
-rw-r--r--lib/std/Thread.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index aaf0fc3440..d52515b88d 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -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 = .{