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
signature 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(
5353 len_align: u29,
5454 ra: usize,
5555 ) 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);
5757 if (result) |_| {
5858 logHelper(
5959 success_log_level,
......@@ -78,7 +78,7 @@ pub fn ScopedLoggingAllocator(
7878 len_align: u29,
7979 ra: usize,
8080 ) 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| {
8282 if (new_len == 0) {
8383 logHelper(success_log_level, "free - success - len: {}", .{buf.len});
8484 } else if (new_len <= buf.len) {
lib/std/mem.zig+2-2
......@@ -40,9 +40,9 @@ pub fn ValidationAllocator(comptime T: type) type {
4040
4141 underlying_allocator: T,
4242
43 pub fn init(allocator: T) @This() {
43 pub fn init(underlying_allocator: T) @This() {
4444 return .{
45 .underlying_allocator = allocator,
45 .underlying_allocator = underlying_allocator,
4646 };
4747 }
4848
lib/std/testing/failing_allocator.zig+2-2
......@@ -28,9 +28,9 @@ pub const FailingAllocator = struct {
2828 /// var a = try failing_alloc.create(i32);
2929 /// var b = try failing_alloc.create(i32);
3030 /// 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 {
3232 return FailingAllocator{
33 .internal_allocator = allocator,
33 .internal_allocator = internal_allocator,
3434 .fail_index = fail_index,
3535 .index = 0,
3636 .allocated_bytes = 0,
test/compile_errors.zig+3-3
......@@ -6550,9 +6550,9 @@ pub fn addCases(ctx: *TestContext) !void {
65506550 ctx.objErrStage1("method call with first arg type wrong container",
65516551 \\pub const List = struct {
65526552 \\ len: usize,
6553 \\ allocator: Allocator,
6553 \\ allocator: *Allocator,
65546554 \\
6555 \\ pub fn init(allocator: Allocator) List {
6555 \\ pub fn init(allocator: *Allocator) List {
65566556 \\ return List {
65576557 \\ .len = 0,
65586558 \\ .allocator = allocator,
......@@ -6573,7 +6573,7 @@ pub fn addCases(ctx: *TestContext) !void {
65736573 \\ x.init();
65746574 \\}
65756575 , &[_][]const u8{
6576 "tmp.zig:23:5: error: expected type 'Allocator', found '*List'",
6576 "tmp.zig:23:5: error: expected type '*Allocator', found '*List'",
65776577 });
65786578
65796579 ctx.objErrStage1("binary not on number literal",
test/standalone/brace_expansion/main.zig+1-1
......@@ -16,7 +16,7 @@ const Token = union(enum) {
1616};
1717
1818var gpa = std.heap.GeneralPurposeAllocator(.{}){};
19const global_allocator = gpa.allocator();
19var global_allocator = gpa.allocator();
2020
2121fn tokenize(input: []const u8) !ArrayList(Token) {
2222 const State = enum {