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