diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-16 13:31:16 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-16 13:31:16 -0700 |
| commit | 92a09eb1e4d5914e5ea81c55c5feb322fcd90e7b (patch) | |
| tree | b987ce9f617823898b9c339c3fbfa1c0f90e3168 | |
| parent | 1f313b3d7c757a8cdc5a52a1986f0f694b7ffc5f (diff) | |
| download | zig-92a09eb1e4d5914e5ea81c55c5feb322fcd90e7b.tar.gz zig-92a09eb1e4d5914e5ea81c55c5feb322fcd90e7b.zip | |
std.heap.GeneralPurposeAllocator: use `var` for mutable locals
Required to be compatible with new language semantics.
| -rw-r--r-- | lib/std/heap/general_purpose_allocator.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/std/heap/general_purpose_allocator.zig b/lib/std/heap/general_purpose_allocator.zig index 87c762fac1..33d89e23c7 100644 --- a/lib/std/heap/general_purpose_allocator.zig +++ b/lib/std/heap/general_purpose_allocator.zig @@ -1109,7 +1109,8 @@ test "shrink large object to large object with larger alignment" { const allocator = gpa.allocator(); var debug_buffer: [1000]u8 = undefined; - const debug_allocator = std.heap.FixedBufferAllocator.init(&debug_buffer).allocator(); + var fba = std.heap.FixedBufferAllocator.init(&debug_buffer); + const debug_allocator = fba.allocator(); const alloc_size = page_size * 2 + 50; var slice = try allocator.alignedAlloc(u8, 16, alloc_size); @@ -1180,7 +1181,8 @@ test "realloc large object to larger alignment" { const allocator = gpa.allocator(); var debug_buffer: [1000]u8 = undefined; - const debug_allocator = std.heap.FixedBufferAllocator.init(&debug_buffer).allocator(); + var fba = std.heap.FixedBufferAllocator.init(&debug_buffer); + const debug_allocator = fba.allocator(); var slice = try allocator.alignedAlloc(u8, 16, page_size * 2 + 50); defer allocator.free(slice); |
