From 378d3e44034e817093966ea42c2940d6a0482dd8 Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Mon, 15 Oct 2018 09:51:15 -0400 Subject: Solve the return type ambiguity (#1628) Changed container and initializer syntax * { ... } -> . { ... } * { ... } -> . { ...} --- std/atomic/stack.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'std/atomic/stack.zig') diff --git a/std/atomic/stack.zig b/std/atomic/stack.zig index b69a93733c..9222b8de50 100644 --- a/std/atomic/stack.zig +++ b/std/atomic/stack.zig @@ -5,19 +5,19 @@ const AtomicOrder = builtin.AtomicOrder; /// Many reader, many writer, non-allocating, thread-safe /// Uses a spinlock to protect push() and pop() pub fn Stack(comptime T: type) type { - return struct { + return struct.{ root: ?*Node, lock: u8, pub const Self = @This(); - pub const Node = struct { + pub const Node = struct.{ next: ?*Node, data: T, }; pub fn init() Self { - return Self{ + return Self.{ .root = null, .lock = 0, }; @@ -54,7 +54,7 @@ pub fn Stack(comptime T: type) type { } const std = @import("../index.zig"); -const Context = struct { +const Context = struct.{ allocator: *std.mem.Allocator, stack: *Stack(i32), put_sum: isize, @@ -81,7 +81,7 @@ test "std.atomic.stack" { var a = &fixed_buffer_allocator.allocator; var stack = Stack(i32).init(); - var context = Context{ + var context = Context.{ .allocator = a, .stack = &stack, .put_sum = 0, @@ -125,7 +125,7 @@ fn startPuts(ctx: *Context) u8 { while (put_count != 0) : (put_count -= 1) { std.os.time.sleep(1); // let the os scheduler be our fuzz const x = @bitCast(i32, r.random.scalar(u32)); - const node = ctx.allocator.create(Stack(i32).Node{ + const node = ctx.allocator.create(Stack(i32).Node.{ .next = undefined, .data = x, }) catch unreachable; -- cgit v1.2.3