diff --git a/lib/std/crypto/poly1305.zig b/lib/std/crypto/poly1305.zig index 254e19ae02..787f105904 100644 --- a/lib/std/crypto/poly1305.zig +++ b/lib/std/crypto/poly1305.zig @@ -12,7 +12,7 @@ pub const Poly1305 = struct { // accumulated hash h: [3]u64 = [_]u64{ 0, 0, 0 }, // random number added at the end (from the secret key) - pad: [2]u64, + end_pad: [2]u64, // how many bytes are waiting to be processed in a partial block leftover: usize = 0, // partial block buffer @@ -24,7 +24,7 @@ pub const Poly1305 = struct { mem.readInt(u64, key[0..8], .little) & 0x0ffffffc0fffffff, mem.readInt(u64, key[8..16], .little) & 0x0ffffffc0ffffffc, }, - .pad = [_]u64{ + .end_pad = [_]u64{ mem.readInt(u64, key[16..24], .little), mem.readInt(u64, key[24..32], .little), }, @@ -177,9 +177,9 @@ pub const Poly1305 = struct { h1 ^= mask & (h1 ^ h_p1); // Add the first half of the key, we intentionally don't use @addWithOverflow() here. - st.h[0] = h0 +% st.pad[0]; - const c = ((h0 & st.pad[0]) | ((h0 | st.pad[0]) & ~st.h[0])) >> 63; - st.h[1] = h1 +% st.pad[1] +% c; + st.h[0] = h0 +% st.end_pad[0]; + const c = ((h0 & st.end_pad[0]) | ((h0 | st.end_pad[0]) & ~st.h[0])) >> 63; + st.h[1] = h1 +% st.end_pad[1] +% c; mem.writeInt(u64, out[0..8], st.h[0], .little); mem.writeInt(u64, out[8..16], st.h[1], .little); diff --git a/lib/std/debug/Pdb.zig b/lib/std/debug/Pdb.zig index 2b2f37e7b6..a85a6df61c 100644 --- a/lib/std/debug/Pdb.zig +++ b/lib/std/debug/Pdb.zig @@ -300,11 +300,10 @@ pub fn getLineNumberInfo(self: *Pdb, module: *Module, address: u64) !std.debug.S const found_line_index = start_line_index + line_entry_idx * @sizeOf(pdb.LineNumberEntry); const line_num_entry: *align(1) pdb.LineNumberEntry = @ptrCast(&subsect_info[found_line_index]); - const flags: *align(1) pdb.LineNumberEntry.Flags = @ptrCast(&line_num_entry.Flags); return .{ .file_name = source_file_name, - .line = flags.Start, + .line = line_num_entry.Flags.Start, .column = column, }; } diff --git a/lib/std/enums.zig b/lib/std/enums.zig index a051d96112..aebfe2a18a 100644 --- a/lib/std/enums.zig +++ b/lib/std/enums.zig @@ -1501,7 +1501,7 @@ test values { X, Y, Z, - pub const X = 1; + const A = 1; }; try testing.expectEqualSlices(E, &.{ .X, .Y, .Z }, values(E)); } diff --git a/lib/std/heap/sbrk_allocator.zig b/lib/std/heap/sbrk_allocator.zig index 3ccc2dddf7..08933fed52 100644 --- a/lib/std/heap/sbrk_allocator.zig +++ b/lib/std/heap/sbrk_allocator.zig @@ -7,7 +7,7 @@ const assert = std.debug.assert; pub fn SbrkAllocator(comptime sbrk: *const fn (n: usize) usize) type { return struct { - pub const vtable = Allocator.VTable{ + pub const vtable: Allocator.VTable = .{ .alloc = alloc, .resize = resize, .free = free, @@ -15,8 +15,6 @@ pub fn SbrkAllocator(comptime sbrk: *const fn (n: usize) usize) type { pub const Error = Allocator.Error; - lock: std.Thread.Mutex = .{}, - const max_usize = math.maxInt(usize); const ushift = math.Log2Int(usize); const bigpage_size = 64 * 1024; diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 3d3bfca1f9..e7ea5b5f0e 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -294,7 +294,7 @@ test declarations { pub fn a() void {} }; const U1 = union { - a: u8, + b: u8, pub fn a() void {} }; @@ -334,7 +334,7 @@ test declarationInfo { pub fn a() void {} }; const U1 = union { - a: u8, + b: u8, pub fn a() void {} }; diff --git a/lib/std/os/uefi/device_path.zig b/lib/std/os/uefi/device_path.zig index 55a3763d66..e02d452b09 100644 --- a/lib/std/os/uefi/device_path.zig +++ b/lib/std/os/uefi/device_path.zig @@ -4,38 +4,38 @@ const uefi = std.os.uefi; const Guid = uefi.Guid; pub const DevicePath = union(Type) { - Hardware: Hardware, - Acpi: Acpi, - Messaging: Messaging, - Media: Media, - BiosBootSpecification: BiosBootSpecification, - End: End, + hardware: Hardware, + acpi: Acpi, + messaging: Messaging, + media: Media, + bios_boot_specification: BiosBootSpecification, + end: End, pub const Type = enum(u8) { - Hardware = 0x01, - Acpi = 0x02, - Messaging = 0x03, - Media = 0x04, - BiosBootSpecification = 0x05, - End = 0x7f, + hardware = 0x01, + acpi = 0x02, + messaging = 0x03, + media = 0x04, + bios_boot_specification = 0x05, + end = 0x7f, _, }; pub const Hardware = union(Subtype) { - Pci: *const PciDevicePath, - PcCard: *const PcCardDevicePath, - MemoryMapped: *const MemoryMappedDevicePath, - Vendor: *const VendorDevicePath, - Controller: *const ControllerDevicePath, - Bmc: *const BmcDevicePath, + pci: *const PciDevicePath, + pc_card: *const PcCardDevicePath, + memory_mapped: *const MemoryMappedDevicePath, + vendor: *const VendorDevicePath, + controller: *const ControllerDevicePath, + bmc: *const BmcDevicePath, pub const Subtype = enum(u8) { - Pci = 1, - PcCard = 2, - MemoryMapped = 3, - Vendor = 4, - Controller = 5, - Bmc = 6, + pci = 1, + pc_card = 2, + memory_mapped = 3, + vendor = 4, + controller = 5, + bmc = 6, _, }; @@ -151,14 +151,14 @@ pub const DevicePath = union(Type) { }; pub const Acpi = union(Subtype) { - Acpi: *const BaseAcpiDevicePath, - ExpandedAcpi: *const ExpandedAcpiDevicePath, - Adr: *const AdrDevicePath, + acpi: *const BaseAcpiDevicePath, + expanded_acpi: *const ExpandedAcpiDevicePath, + adr: *const AdrDevicePath, pub const Subtype = enum(u8) { - Acpi = 1, - ExpandedAcpi = 2, - Adr = 3, + acpi = 1, + expanded_acpi = 2, + adr = 3, _, }; diff --git a/lib/std/pdb.zig b/lib/std/pdb.zig index 31ad02e945..c30a963a9a 100644 --- a/lib/std/pdb.zig +++ b/lib/std/pdb.zig @@ -399,17 +399,14 @@ pub const LineBlockFragmentHeader = extern struct { pub const LineNumberEntry = extern struct { /// Offset to start of code bytes for line number Offset: u32, - Flags: u32, - - /// TODO runtime crash when I make the actual type of Flags this - pub const Flags = packed struct { + Flags: packed struct(u32) { /// Start line number Start: u24, /// Delta of lines to the end of the expression. Still unclear. // TODO figure out the point of this field. End: u7, IsStatement: bool, - }; + }, }; pub const ColumnNumberEntry = extern struct {