Skip to content

Commit

Permalink
upgrade to 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
krichprollsch committed Feb 12, 2025
1 parent a3a0145 commit 1295246
Show file tree
Hide file tree
Showing 8 changed files with 449 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/zig-fmt.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: zig-fmt

env:
ZIG_VERSION: 0.13.0
ZIG_VERSION: master

on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zig-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: zig-test

env:
ZIG_VERSION: 0.13.0
ZIG_VERSION: master

on:
push:
Expand Down
8 changes: 5 additions & 3 deletions checksum.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const mem = std.mem;
const testing = std.testing;
const assert = std.debug.assert;

const Aegis128LMac_128 = std.crypto.auth.aegis.Aegis128LMac_128;
const stdx = @import("stdx.zig");

const Aegis128LMac_128 = stdx.aegis.Aegis128LMac_128;

var seed_once = std.once(seed_init);
var seed_state: Aegis128LMac_128 = undefined;
Expand Down Expand Up @@ -122,7 +124,7 @@ test "checksum test vectors" {
}

test "checksum simple fuzzing" {
var prng = std.rand.DefaultPrng.init(42);
var prng = std.Random.DefaultPrng.init(42);

const msg_min = 1;
const msg_max = 1 * 1024 * 1024;
Expand Down Expand Up @@ -180,7 +182,7 @@ test "checksum stability" {
}

// Pseudo-random data from a specific PRNG of various lengths.
var prng = std.rand.Xoshiro256.init(92);
var prng = std.Random.Xoshiro256.init(92);
subcase = 0;
while (subcase < 256) : (subcase += 1) {
const message = buf[0 .. subcase + 13];
Expand Down
13 changes: 6 additions & 7 deletions io/linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,11 @@ pub const IO = struct {
// We must use the same clock source used by io_uring (CLOCK_MONOTONIC) since we specify the
// timeout below as an absolute value. Otherwise, we may deadlock if the clock sources are
// dramatically different. Any kernel that supports io_uring will support CLOCK_MONOTONIC.
var current_ts: posix.timespec = undefined;
posix.clock_gettime(posix.CLOCK.MONOTONIC, &current_ts) catch unreachable;
const current_ts = posix.clock_gettime(posix.CLOCK.MONOTONIC) catch unreachable;
// The absolute CLOCK_MONOTONIC time after which we may return from this function:
const timeout_ts: os.linux.kernel_timespec = .{
.tv_sec = current_ts.tv_sec,
.tv_nsec = current_ts.tv_nsec + nanoseconds,
.sec = current_ts.sec,
.nsec = current_ts.nsec + nanoseconds,
};
var timeouts: usize = 0;
var etime = false;
Expand Down Expand Up @@ -175,8 +174,8 @@ pub const IO = struct {
// 2) potentially queues more SQEs to take advantage more of the next flush_submissions().
while (self.completed.pop()) |completion| {
if (completion.operation == .timeout and
completion.operation.timeout.timespec.tv_sec == 0 and
completion.operation.timeout.timespec.tv_nsec == 0)
completion.operation.timeout.timespec.sec == 0 and
completion.operation.timeout.timespec.nsec == 0)
{
// Zero-duration timeouts are a special case, and aren't listed in `awaiting`.
maybe(self.awaiting.empty());
Expand Down Expand Up @@ -1359,7 +1358,7 @@ pub const IO = struct {
}.wrapper,
.operation = .{
.timeout = .{
.timespec = .{ .tv_sec = 0, .tv_nsec = nanoseconds },
.timespec = .{ .sec = 0, .nsec = nanoseconds },
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion list.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn DoublyLinkedListType(
comptime field_back_enum: std.meta.FieldEnum(Node),
comptime field_next_enum: std.meta.FieldEnum(Node),
) type {
assert(@typeInfo(Node) == .Struct);
assert(@typeInfo(Node) == .@"struct");
assert(field_back_enum != field_next_enum);
assert(std.meta.FieldType(Node, field_back_enum) == ?*Node);
assert(std.meta.FieldType(Node, field_next_enum) == ?*Node);
Expand Down
4 changes: 3 additions & 1 deletion stdx.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;

pub const aegis = @import("./stdx/aegis.zig");

/// `maybe` is the dual of `assert`: it signals that condition is sometimes true
/// and sometimes false.
///
Expand All @@ -17,7 +19,7 @@ pub const log = if (builtin.is_test)
// Downgrade `err` to `warn` for tests.
// Zig fails any test that does `log.err`, but we want to test those code paths here.
struct {
pub fn scoped(comptime scope: @Type(.EnumLiteral)) type {
pub fn scoped(comptime scope: @Type(.enum_literal)) type {
const base = std.log.scoped(scope);
return struct {
pub const err = warn;
Expand Down
Loading

0 comments on commit 1295246

Please sign in to comment.