authorgravatar for 101306295+PauloCampana@users.noreply.github.comPauloCampana <101306295+PauloCampana@users.noreply.github.com> 2024-10-04 17:50:25-03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-10-04 13:50:25-07:00
log3e62cb5c90608580558fff1af24af68735778392
treec4515cd2f574dcb229aecdcbece458ffb1af3e5e
parenteb363bf84503c428374d5c698ef7ebd574940a11
signaturebadge-check Signed by PGP key B5690EEEBB952194

Remove old deprecated symbols in std (#21584)

Also, actually run tests inside std/tar/writer.zig

6 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
47664766 Converts an integer into an {#link|enum#} value. The return type is the inferred result type.
47674767 </p>
47684768 <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
47704770 safety-checked {#link|Undefined Behavior#}.
47714771 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
47734773 the remaining unnamed integers in the enum's tag type.
47744774 </p>
47754775 {#see_also|@intFromEnum#}
......@@ -6241,11 +6241,13 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
62416241 </li>
62426242 <li>Are you linking libc? In this case, {#syntax#}std.heap.c_allocator{#endsyntax#} is likely
62436243 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>
62446248 <li>
62456249 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#}.
62496251 </li>
62506252 <li>
62516253 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 {
501501 }
502502};
503503
504pub const ThreadSafeFixedBufferAllocator = @compileError("ThreadSafeFixedBufferAllocator has been replaced with `threadSafeAllocator` on FixedBufferAllocator");
505
506504/// Returns a `StackFallbackAllocator` allocating using either a
507505/// `FixedBufferAllocator` on an array of size `size` and falling back to
508506/// `fallback_allocator` if that fails.
lib/std/mem.zig-4
......@@ -4334,8 +4334,6 @@ pub fn alignForwardLog2(addr: usize, log2_alignment: u8) usize {
43344334 return alignForward(usize, addr, alignment);
43354335}
43364336
4337pub const alignForwardGeneric = @compileError("renamed to alignForward");
4338
43394337/// Force an evaluation of the expression; this tries to prevent
43404338/// the compiler from optimizing the computation away even if the
43414339/// result eventually gets discarded.
......@@ -4459,8 +4457,6 @@ pub fn alignBackward(comptime T: type, addr: T, alignment: T) T {
44594457 return addr & ~(alignment - 1);
44604458}
44614459
4462pub const alignBackwardGeneric = @compileError("renamed to alignBackward");
4463
44644460/// Returns whether `alignment` is a valid alignment, meaning it is
44654461/// a positive power of 2.
44664462pub 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 {
240240 @compileError("Unable to derive a sentinel pointer type from " ++ @typeName(T));
241241}
242242
243pub const assumeSentinel = @compileError("This function has been removed, consider using std.mem.sliceTo() or if needed a @ptrCast()");
244
245243pub fn containerLayout(comptime T: type) Type.ContainerLayout {
246244 return switch (@typeInfo(T)) {
247245 .@"struct" => |info| info.layout,
......@@ -930,8 +928,6 @@ pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {
930928 return null;
931929}
932930
933pub const refAllDecls = @compileError("refAllDecls has been moved from std.meta to std.testing");
934
935931/// Returns a slice of pointers to public declarations of a namespace.
936932pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl {
937933 const S = struct {
......@@ -951,8 +947,6 @@ pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const De
951947 }
952948}
953949
954pub const IntType = @compileError("replaced by std.meta.Int");
955
956950pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type {
957951 return @Type(.{
958952 .int = .{
lib/std/tar.zig+1
......@@ -848,6 +848,7 @@ test PaxIterator {
848848
849849test {
850850 _ = @import("tar/test.zig");
851 _ = @import("tar/writer.zig");
851852 _ = Diagnostics;
852853}
853854
lib/std/tar/writer.zig+5-5
......@@ -84,7 +84,7 @@ pub fn Writer(comptime WriterType: type) type {
8484
8585 /// Writes fs.Dir.WalkerEntry. Uses `mtime` from file system entry and
8686 /// 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 {
8888 switch (entry.kind) {
8989 .directory => {
9090 try self.writeDir(entry.path, .{ .mtime = try entryMtime(entry) });
......@@ -95,7 +95,7 @@ pub fn Writer(comptime WriterType: type) type {
9595 try self.writeFile(entry.path, file);
9696 },
9797 .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;
9999 const link_name = try entry.dir.readLink(entry.basename, &link_name_buffer);
100100 try self.writeLink(entry.path, link_name, .{ .mtime = try entryMtime(entry) });
101101 },
......@@ -133,7 +133,7 @@ pub fn Writer(comptime WriterType: type) type {
133133 return self.mtime_now;
134134 }
135135
136 fn entryMtime(entry: std.fs.Dir.Walker.WalkerEntry) !u64 {
136 fn entryMtime(entry: std.fs.Dir.Walker.Entry) !u64 {
137137 const stat = try entry.dir.statFile(entry.basename);
138138 return @intCast(@divFloor(stat.mtime, std.time.ns_per_s));
139139 }
......@@ -424,8 +424,8 @@ test "write files" {
424424 .{ .path = "e123456789" ** 11, .content = "e" },
425425 };
426426
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;
429429
430430 // with root
431431 {