| author | |
| committer | |
| log | 3e62cb5c90608580558fff1af24af68735778392 |
| tree | c4515cd2f574dcb229aecdcbece458ffb1af3e5e |
| parent | eb363bf84503c428374d5c698ef7ebd574940a11 |
| signature |
Also, actually run tests inside std/tar/writer.zig6 files changed, 13 insertions(+), 22 deletions(-)
doc/langref.html.in+7-5| ... | ... | @@ -4766,10 +4766,10 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 4766 | 4766 | Converts an integer into an {#link|enum#} value. The return type is the inferred result type. |
| 4767 | 4767 | </p> |
| 4768 | 4768 | <p> |
| 4769 | Attempting to convert an integer with no corresponding value in the enum invokes | |
| 4769 | Attempting to convert an integer with no corresponding value in the enum invokes | |
| 4770 | 4770 | safety-checked {#link|Undefined Behavior#}. |
| 4771 | 4771 | Note that a {#link|non-exhaustive enum|Non-exhaustive enum#} has corresponding values for all |
| 4772 | integers in the enum's integer tag type: the {#syntax#}_{#endsyntax#} value represents all | |
| 4772 | integers in the enum's integer tag type: the {#syntax#}_{#endsyntax#} value represents all | |
| 4773 | 4773 | the remaining unnamed integers in the enum's tag type. |
| 4774 | 4774 | </p> |
| 4775 | 4775 | {#see_also|@intFromEnum#} |
| ... | ... | @@ -6241,11 +6241,13 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 6241 | 6241 | </li> |
| 6242 | 6242 | <li>Are you linking libc? In this case, {#syntax#}std.heap.c_allocator{#endsyntax#} is likely |
| 6243 | 6243 | the right choice, at least for your main allocator.</li> |
| 6244 | <li> | |
| 6245 | Need to use the same allocator in multiple threads? Use one of your choice | |
| 6246 | wrapped around {#syntax#}std.heap.ThreadSafeAllocator{#endsyntax#} | |
| 6247 | </li> | |
| 6244 | 6248 | <li> |
| 6245 | 6249 | Is the maximum number of bytes that you will need bounded by a number known at |
| 6246 | {#link|comptime#}? In this case, use {#syntax#}std.heap.FixedBufferAllocator{#endsyntax#} or | |
| 6247 | {#syntax#}std.heap.ThreadSafeFixedBufferAllocator{#endsyntax#} depending on whether you need | |
| 6248 | thread-safety or not. | |
| 6250 | {#link|comptime#}? In this case, use {#syntax#}std.heap.FixedBufferAllocator{#endsyntax#}. | |
| 6249 | 6251 | </li> |
| 6250 | 6252 | <li> |
| 6251 | 6253 | Is your program a command line application which runs from start to end without any fundamental |
lib/std/heap.zig-2| ... | ... | @@ -501,8 +501,6 @@ pub const FixedBufferAllocator = struct { |
| 501 | 501 | } |
| 502 | 502 | }; |
| 503 | 503 | |
| 504 | pub const ThreadSafeFixedBufferAllocator = @compileError("ThreadSafeFixedBufferAllocator has been replaced with `threadSafeAllocator` on FixedBufferAllocator"); | |
| 505 | ||
| 506 | 504 | /// Returns a `StackFallbackAllocator` allocating using either a |
| 507 | 505 | /// `FixedBufferAllocator` on an array of size `size` and falling back to |
| 508 | 506 | /// `fallback_allocator` if that fails. |
lib/std/mem.zig-4| ... | ... | @@ -4334,8 +4334,6 @@ pub fn alignForwardLog2(addr: usize, log2_alignment: u8) usize { |
| 4334 | 4334 | return alignForward(usize, addr, alignment); |
| 4335 | 4335 | } |
| 4336 | 4336 | |
| 4337 | pub const alignForwardGeneric = @compileError("renamed to alignForward"); | |
| 4338 | ||
| 4339 | 4337 | /// Force an evaluation of the expression; this tries to prevent |
| 4340 | 4338 | /// the compiler from optimizing the computation away even if the |
| 4341 | 4339 | /// result eventually gets discarded. |
| ... | ... | @@ -4459,8 +4457,6 @@ pub fn alignBackward(comptime T: type, addr: T, alignment: T) T { |
| 4459 | 4457 | return addr & ~(alignment - 1); |
| 4460 | 4458 | } |
| 4461 | 4459 | |
| 4462 | pub const alignBackwardGeneric = @compileError("renamed to alignBackward"); | |
| 4463 | ||
| 4464 | 4460 | /// Returns whether `alignment` is a valid alignment, meaning it is |
| 4465 | 4461 | /// a positive power of 2. |
| 4466 | 4462 | pub fn isValidAlign(alignment: usize) bool { |
lib/std/meta.zig-6| ... | ... | @@ -240,8 +240,6 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type { |
| 240 | 240 | @compileError("Unable to derive a sentinel pointer type from " ++ @typeName(T)); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | pub const assumeSentinel = @compileError("This function has been removed, consider using std.mem.sliceTo() or if needed a @ptrCast()"); | |
| 244 | ||
| 245 | 243 | pub fn containerLayout(comptime T: type) Type.ContainerLayout { |
| 246 | 244 | return switch (@typeInfo(T)) { |
| 247 | 245 | .@"struct" => |info| info.layout, |
| ... | ... | @@ -930,8 +928,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int { |
| 930 | 928 | return null; |
| 931 | 929 | } |
| 932 | 930 | |
| 933 | pub const refAllDecls = @compileError("refAllDecls has been moved from std.meta to std.testing"); | |
| 934 | ||
| 935 | 931 | /// Returns a slice of pointers to public declarations of a namespace. |
| 936 | 932 | pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl { |
| 937 | 933 | const S = struct { |
| ... | ... | @@ -951,8 +947,6 @@ pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const De |
| 951 | 947 | } |
| 952 | 948 | } |
| 953 | 949 | |
| 954 | pub const IntType = @compileError("replaced by std.meta.Int"); | |
| 955 | ||
| 956 | 950 | pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type { |
| 957 | 951 | return @Type(.{ |
| 958 | 952 | .int = .{ |
lib/std/tar.zig+1| ... | ... | @@ -848,6 +848,7 @@ test PaxIterator { |
| 848 | 848 | |
| 849 | 849 | test { |
| 850 | 850 | _ = @import("tar/test.zig"); |
| 851 | _ = @import("tar/writer.zig"); | |
| 851 | 852 | _ = Diagnostics; |
| 852 | 853 | } |
| 853 | 854 |
lib/std/tar/writer.zig+5-5| ... | ... | @@ -84,7 +84,7 @@ pub fn Writer(comptime WriterType: type) type { |
| 84 | 84 | |
| 85 | 85 | /// Writes fs.Dir.WalkerEntry. Uses `mtime` from file system entry and |
| 86 | 86 | /// default for entry mode . |
| 87 | pub fn writeEntry(self: *Self, entry: std.fs.Dir.Walker.WalkerEntry) !void { | |
| 87 | pub fn writeEntry(self: *Self, entry: std.fs.Dir.Walker.Entry) !void { | |
| 88 | 88 | switch (entry.kind) { |
| 89 | 89 | .directory => { |
| 90 | 90 | try self.writeDir(entry.path, .{ .mtime = try entryMtime(entry) }); |
| ... | ... | @@ -95,7 +95,7 @@ pub fn Writer(comptime WriterType: type) type { |
| 95 | 95 | try self.writeFile(entry.path, file); |
| 96 | 96 | }, |
| 97 | 97 | .sym_link => { |
| 98 | var link_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 98 | var link_name_buffer: [std.fs.max_path_bytes]u8 = undefined; | |
| 99 | 99 | const link_name = try entry.dir.readLink(entry.basename, &link_name_buffer); |
| 100 | 100 | try self.writeLink(entry.path, link_name, .{ .mtime = try entryMtime(entry) }); |
| 101 | 101 | }, |
| ... | ... | @@ -133,7 +133,7 @@ pub fn Writer(comptime WriterType: type) type { |
| 133 | 133 | return self.mtime_now; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | fn entryMtime(entry: std.fs.Dir.Walker.WalkerEntry) !u64 { | |
| 136 | fn entryMtime(entry: std.fs.Dir.Walker.Entry) !u64 { | |
| 137 | 137 | const stat = try entry.dir.statFile(entry.basename); |
| 138 | 138 | return @intCast(@divFloor(stat.mtime, std.time.ns_per_s)); |
| 139 | 139 | } |
| ... | ... | @@ -424,8 +424,8 @@ test "write files" { |
| 424 | 424 | .{ .path = "e123456789" ** 11, .content = "e" }, |
| 425 | 425 | }; |
| 426 | 426 | |
| 427 | var file_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 428 | var link_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 427 | var file_name_buffer: [std.fs.max_path_bytes]u8 = undefined; | |
| 428 | var link_name_buffer: [std.fs.max_path_bytes]u8 = undefined; | |
| 429 | 429 | |
| 430 | 430 | // with root |
| 431 | 431 | { |