authorgravatar for leecannon@leecannon.xyzLee Cannon <leecannon@leecannon.xyz> 2021-10-29 03:00:00+01:00
committergravatar for leecannon@leecannon.xyzLee Cannon <leecannon@leecannon.xyz> 2021-11-30 23:32:48+00:00
log80bbf234e0d31266c72bb6e93db2d2199ac5920d
tree1286f25461ac97ee241941949eeac912c4875502
parent1093b09a989edb8553e79b061bb15c5745f5d193
signaturelock-open Commit is signed but in an unrecognized format.

allocgate: fix failing tests


5 files changed, 10 insertions(+), 10 deletions(-)

lib/std/heap/logging_allocator.zig+2-2
...@@ -53,7 +53,7 @@ pub fn ScopedLoggingAllocator(...@@ -53,7 +53,7 @@ pub fn ScopedLoggingAllocator(
53 len_align: u29,53 len_align: u29,
54 ra: usize,54 ra: usize,
55 ) error{OutOfMemory}![]u8 {55 ) error{OutOfMemory}![]u8 {
56 const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ra);56 const result = self.parent_allocator.allocFn(self.parent_allocator.ptr, len, ptr_align, len_align, ra);
57 if (result) |_| {57 if (result) |_| {
58 logHelper(58 logHelper(
59 success_log_level,59 success_log_level,
...@@ -78,7 +78,7 @@ pub fn ScopedLoggingAllocator(...@@ -78,7 +78,7 @@ pub fn ScopedLoggingAllocator(
78 len_align: u29,78 len_align: u29,
79 ra: usize,79 ra: usize,
80 ) error{OutOfMemory}!usize {80 ) error{OutOfMemory}!usize {
81 if (self.parent_allocator.resizeFn(self.parent_allocator, buf, buf_align, new_len, len_align, ra)) |resized_len| {81 if (self.parent_allocator.resizeFn(self.parent_allocator.ptr, buf, buf_align, new_len, len_align, ra)) |resized_len| {
82 if (new_len == 0) {82 if (new_len == 0) {
83 logHelper(success_log_level, "free - success - len: {}", .{buf.len});83 logHelper(success_log_level, "free - success - len: {}", .{buf.len});
84 } else if (new_len <= buf.len) {84 } else if (new_len <= buf.len) {
lib/std/mem.zig+2-2
...@@ -40,9 +40,9 @@ pub fn ValidationAllocator(comptime T: type) type {...@@ -40,9 +40,9 @@ pub fn ValidationAllocator(comptime T: type) type {
4040
41 underlying_allocator: T,41 underlying_allocator: T,
4242
43 pub fn init(allocator: T) @This() {43 pub fn init(underlying_allocator: T) @This() {
44 return .{44 return .{
45 .underlying_allocator = allocator,45 .underlying_allocator = underlying_allocator,
46 };46 };
47 }47 }
4848
lib/std/testing/failing_allocator.zig+2-2
...@@ -28,9 +28,9 @@ pub const FailingAllocator = struct {...@@ -28,9 +28,9 @@ pub const FailingAllocator = struct {
28 /// var a = try failing_alloc.create(i32);28 /// var a = try failing_alloc.create(i32);
29 /// var b = try failing_alloc.create(i32);29 /// var b = try failing_alloc.create(i32);
30 /// testing.expectError(error.OutOfMemory, failing_alloc.create(i32));30 /// testing.expectError(error.OutOfMemory, failing_alloc.create(i32));
31 pub fn init(allocator: mem.Allocator, fail_index: usize) FailingAllocator {31 pub fn init(internal_allocator: mem.Allocator, fail_index: usize) FailingAllocator {
32 return FailingAllocator{32 return FailingAllocator{
33 .internal_allocator = allocator,33 .internal_allocator = internal_allocator,
34 .fail_index = fail_index,34 .fail_index = fail_index,
35 .index = 0,35 .index = 0,
36 .allocated_bytes = 0,36 .allocated_bytes = 0,
test/compile_errors.zig+3-3
...@@ -6550,9 +6550,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -6550,9 +6550,9 @@ pub fn addCases(ctx: *TestContext) !void {
6550 ctx.objErrStage1("method call with first arg type wrong container",6550 ctx.objErrStage1("method call with first arg type wrong container",
6551 \\pub const List = struct {6551 \\pub const List = struct {
6552 \\ len: usize,6552 \\ len: usize,
6553 \\ allocator: Allocator,6553 \\ allocator: *Allocator,
6554 \\6554 \\
6555 \\ pub fn init(allocator: Allocator) List {6555 \\ pub fn init(allocator: *Allocator) List {
6556 \\ return List {6556 \\ return List {
6557 \\ .len = 0,6557 \\ .len = 0,
6558 \\ .allocator = allocator,6558 \\ .allocator = allocator,
...@@ -6573,7 +6573,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -6573,7 +6573,7 @@ pub fn addCases(ctx: *TestContext) !void {
6573 \\ x.init();6573 \\ x.init();
6574 \\}6574 \\}
6575 , &[_][]const u8{6575 , &[_][]const u8{
6576 "tmp.zig:23:5: error: expected type 'Allocator', found '*List'",6576 "tmp.zig:23:5: error: expected type '*Allocator', found '*List'",
6577 });6577 });
65786578
6579 ctx.objErrStage1("binary not on number literal",6579 ctx.objErrStage1("binary not on number literal",
test/standalone/brace_expansion/main.zig+1-1
...@@ -16,7 +16,7 @@ const Token = union(enum) {...@@ -16,7 +16,7 @@ const Token = union(enum) {
16};16};
1717
18var gpa = std.heap.GeneralPurposeAllocator(.{}){};18var gpa = std.heap.GeneralPurposeAllocator(.{}){};
19const global_allocator = gpa.allocator();19var global_allocator = gpa.allocator();
2020
21fn tokenize(input: []const u8) !ArrayList(Token) {21fn tokenize(input: []const u8) !ArrayList(Token) {
22 const State = enum {22 const State = enum {