authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-15 19:40:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-16 14:46:53-04:00
logd3d24874c91054a70c706fed47278c81c9ce890a
tree6ee731cf3c9acaac8292bd2701cafc6dee9e0d4d
parent7b32aacbafda2946c67ff4d4b329cdededf1da29

std: remove deprecated API for the upcoming release

See #3811

16 files changed, 8 insertions(+), 94 deletions(-)

lib/std/array_hash_map.zig-4
......@@ -201,8 +201,6 @@ pub fn ArrayHashMap(
201201 return self.unmanaged.getOrPutValueContext(self.allocator, key, value, self.ctx);
202202 }
203203
204 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
205
206204 /// Increases capacity, guaranteeing that insertions up until the
207205 /// `expected_count` will not cause an allocation, and therefore cannot fail.
208206 pub fn ensureTotalCapacity(self: *Self, new_capacity: usize) !void {
......@@ -755,8 +753,6 @@ pub fn ArrayHashMapUnmanaged(
755753 return res;
756754 }
757755
758 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
759
760756 /// Increases capacity, guaranteeing that insertions up until the
761757 /// `expected_count` will not cause an allocation, and therefore cannot fail.
762758 pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_capacity: usize) !void {
lib/std/array_list.zig-6
......@@ -83,8 +83,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
8383 };
8484 }
8585
86 pub const toUnmanaged = @compileError("deprecated; use `moveToUnmanaged` which has different semantics.");
87
8886 /// Initializes an ArrayListUnmanaged with the `items` and `capacity` fields
8987 /// of this ArrayList. Empties this ArrayList.
9088 pub fn moveToUnmanaged(self: *Self) ArrayListAlignedUnmanaged(T, alignment) {
......@@ -325,8 +323,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
325323 self.capacity = 0;
326324 }
327325
328 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
329
330326 /// Modify the array so that it can hold at least `new_capacity` items.
331327 /// Invalidates pointers if additional memory is needed.
332328 pub fn ensureTotalCapacity(self: *Self, new_capacity: usize) Allocator.Error!void {
......@@ -721,8 +717,6 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
721717 self.capacity = 0;
722718 }
723719
724 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
725
726720 /// Modify the array so that it can hold at least `new_capacity` items.
727721 /// Invalidates pointers if additional memory is needed.
728722 pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_capacity: usize) Allocator.Error!void {
lib/std/base64.zig-4
......@@ -69,10 +69,6 @@ pub const url_safe_no_pad = Codecs{
6969 .Decoder = Base64Decoder.init(url_safe_alphabet_chars, null),
7070};
7171
72pub const standard_pad_char = @compileError("deprecated; use standard.pad_char");
73pub const standard_encoder = @compileError("deprecated; use standard.Encoder");
74pub const standard_decoder = @compileError("deprecated; use standard.Decoder");
75
7672pub const Base64Encoder = struct {
7773 alphabet_chars: [64]u8,
7874 pad_char: ?u8,
lib/std/build.zig+4-26
......@@ -1339,13 +1339,6 @@ test "builder.findProgram compiles" {
13391339 _ = builder.findProgram(&[_][]const u8{}, &[_][]const u8{}) catch null;
13401340}
13411341
1342/// TODO: propose some kind of `@deprecate` builtin so that we can deprecate
1343/// this while still having somewhat non-lazy decls. In this file we wanted to do
1344/// refAllDecls for example which makes it trigger `@compileError` if you try
1345/// to use that strategy.
1346pub const Version = @compileError("deprecated; Use `std.builtin.Version`");
1347pub const Target = @compileError("deprecated; Use `std.zig.CrossTarget`");
1348
13491342pub const Pkg = struct {
13501343 name: []const u8,
13511344 source: FileSource,
......@@ -2314,29 +2307,19 @@ pub const LibExeObjStep = struct {
23142307 self.linkLibraryOrObject(obj);
23152308 }
23162309
2317 /// TODO deprecated, use `addSystemIncludePath`.
2318 pub fn addSystemIncludeDir(self: *LibExeObjStep, path: []const u8) void {
2319 self.addSystemIncludePath(path);
2320 }
2310 pub const addSystemIncludeDir = @compileError("deprecated; use addSystemIncludePath");
2311 pub const addIncludeDir = @compileError("deprecated; use addIncludePath");
2312 pub const addLibPath = @compileError("deprecated, use addLibraryPath");
2313 pub const addFrameworkDir = @compileError("deprecated, use addFrameworkPath");
23212314
23222315 pub fn addSystemIncludePath(self: *LibExeObjStep, path: []const u8) void {
23232316 self.include_dirs.append(IncludeDir{ .raw_path_system = self.builder.dupe(path) }) catch unreachable;
23242317 }
23252318
2326 /// TODO deprecated, use `addIncludePath`.
2327 pub fn addIncludeDir(self: *LibExeObjStep, path: []const u8) void {
2328 self.addIncludePath(path);
2329 }
2330
23312319 pub fn addIncludePath(self: *LibExeObjStep, path: []const u8) void {
23322320 self.include_dirs.append(IncludeDir{ .raw_path = self.builder.dupe(path) }) catch unreachable;
23332321 }
23342322
2335 /// TODO deprecated, use `addLibraryPath`.
2336 pub fn addLibPath(self: *LibExeObjStep, path: []const u8) void {
2337 self.addLibraryPath(path);
2338 }
2339
23402323 pub fn addLibraryPath(self: *LibExeObjStep, path: []const u8) void {
23412324 self.lib_paths.append(self.builder.dupe(path)) catch unreachable;
23422325 }
......@@ -2345,11 +2328,6 @@ pub const LibExeObjStep = struct {
23452328 self.rpaths.append(self.builder.dupe(path)) catch unreachable;
23462329 }
23472330
2348 /// TODO deprecated, use `addFrameworkPath`.
2349 pub fn addFrameworkDir(self: *LibExeObjStep, dir_path: []const u8) void {
2350 self.addFrameworkPath(dir_path);
2351 }
2352
23532331 pub fn addFrameworkPath(self: *LibExeObjStep, dir_path: []const u8) void {
23542332 self.framework_dirs.append(self.builder.dupe(dir_path)) catch unreachable;
23552333 }
lib/std/builtin.zig+2-5
......@@ -184,9 +184,7 @@ pub const SourceLocation = struct {
184184};
185185
186186pub const TypeId = std.meta.Tag(Type);
187
188/// TODO deprecated, use `Type`
189pub const TypeInfo = Type;
187pub const TypeInfo = @compileError("deprecated; use Type");
190188
191189/// This data structure is used by the Zig language code generation and
192190/// therefore must be kept in sync with the compiler implementation.
......@@ -359,8 +357,7 @@ pub const Type = union(enum) {
359357 decls: []const Declaration,
360358 };
361359
362 /// TODO deprecated use Fn.Param
363 pub const FnArg = Fn.Param;
360 pub const FnArg = @compileError("deprecated; use Fn.Param");
364361
365362 /// This data structure is used by the Zig language code generation and
366363 /// therefore must be kept in sync with the compiler implementation.
lib/std/crypto/25519/edwards25519.zig-1
......@@ -69,7 +69,6 @@ pub const Edwards25519 = struct {
6969 .is_base = true,
7070 };
7171
72 pub const neutralElement = @compileError("deprecated: use identityElement instead");
7372 pub const identityElement = Edwards25519{ .x = Fe.zero, .y = Fe.one, .z = Fe.one, .t = Fe.zero };
7473
7574 /// Reject the neutral element.
lib/std/fmt.zig-3
......@@ -1885,7 +1885,6 @@ test "parseUnsigned" {
18851885}
18861886
18871887pub const parseFloat = @import("fmt/parse_float.zig").parseFloat;
1888pub const parseHexFloat = @compileError("deprecated; use `parseFloat`");
18891888pub const ParseFloatError = @import("fmt/parse_float.zig").ParseFloatError;
18901889
18911890test {
......@@ -1948,8 +1947,6 @@ pub fn allocPrint(allocator: mem.Allocator, comptime fmt: []const u8, args: anyt
19481947 };
19491948}
19501949
1951pub const allocPrint0 = @compileError("deprecated; use allocPrintZ");
1952
19531950pub fn allocPrintZ(allocator: mem.Allocator, comptime fmt: []const u8, args: anytype) AllocPrintError![:0]u8 {
19541951 const result = try allocPrint(allocator, fmt ++ "\x00", args);
19551952 return result[0 .. result.len - 1 :0];
lib/std/hash_map.zig-6
......@@ -120,8 +120,6 @@ pub const StringIndexAdapter = struct {
120120 }
121121};
122122
123pub const DefaultMaxLoadPercentage = @compileError("deprecated; use `default_max_load_percentage`");
124
125123pub const default_max_load_percentage = 80;
126124
127125/// This function issues a compile error with a helpful message if there
......@@ -517,8 +515,6 @@ pub fn HashMap(
517515 return self.unmanaged.getOrPutValueContext(self.allocator, key, value, self.ctx);
518516 }
519517
520 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
521
522518 /// Increases capacity, guaranteeing that insertions up until the
523519 /// `expected_count` will not cause an allocation, and therefore cannot fail.
524520 pub fn ensureTotalCapacity(self: *Self, expected_count: Size) Allocator.Error!void {
......@@ -900,8 +896,6 @@ pub fn HashMapUnmanaged(
900896 return new_cap;
901897 }
902898
903 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
904
905899 pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_size: Size) Allocator.Error!void {
906900 if (@sizeOf(Context) != 0)
907901 @compileError("Cannot infer context " ++ @typeName(Context) ++ ", call ensureTotalCapacityContext instead.");
lib/std/log.zig-12
......@@ -169,10 +169,6 @@ pub fn defaultLog(
169169/// provided here.
170170pub fn scoped(comptime scope: @Type(.EnumLiteral)) type {
171171 return struct {
172 pub const emerg = @compileError("deprecated; use err instead of emerg");
173 pub const alert = @compileError("deprecated; use err instead of alert");
174 pub const crit = @compileError("deprecated; use err instead of crit");
175
176172 /// Log an error message. This log level is intended to be used
177173 /// when something has gone wrong. This might be recoverable or might
178174 /// be followed by the program exiting.
......@@ -194,8 +190,6 @@ pub fn scoped(comptime scope: @Type(.EnumLiteral)) type {
194190 log(.warn, scope, format, args);
195191 }
196192
197 pub const notice = @compileError("deprecated; use info instead of notice");
198
199193 /// Log an info message. This log level is intended to be used for
200194 /// general messages about the state of the program.
201195 pub fn info(
......@@ -219,10 +213,6 @@ pub fn scoped(comptime scope: @Type(.EnumLiteral)) type {
219213/// The default scoped logging namespace.
220214pub const default = scoped(.default);
221215
222pub const emerg = @compileError("deprecated; use err instead of emerg");
223pub const alert = @compileError("deprecated; use err instead of alert");
224pub const crit = @compileError("deprecated; use err instead of crit");
225
226216/// Log an error message using the default scope. This log level is intended to
227217/// be used when something has gone wrong. This might be recoverable or might
228218/// be followed by the program exiting.
......@@ -233,8 +223,6 @@ pub const err = default.err;
233223/// the circumstances would be worth investigating.
234224pub const warn = default.warn;
235225
236pub const notice = @compileError("deprecated; use info instead of notice");
237
238226/// Log an info message using the default scope. This log level is intended to
239227/// be used for general messages about the state of the program.
240228pub const info = default.info;
lib/std/math.zig-7
......@@ -170,13 +170,6 @@ pub fn approxEqRel(comptime T: type, x: T, y: T, tolerance: T) bool {
170170 return @fabs(x - y) <= max(@fabs(x), @fabs(y)) * tolerance;
171171}
172172
173pub fn approxEq(comptime T: type, x: T, y: T, tolerance: T) bool {
174 _ = x;
175 _ = y;
176 _ = tolerance;
177 @compileError("deprecated; use `approxEqAbs` or `approxEqRel`");
178}
179
180173test "approxEqAbs and approxEqRel" {
181174 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
182175 const eps_value = comptime floatEps(T);
lib/std/math/complex.zig-2
......@@ -34,8 +34,6 @@ pub fn Complex(comptime T: type) type {
3434 /// Imaginary part.
3535 im: T,
3636
37 pub const new = @compileError("deprecated; use init()");
38
3937 /// Create a new Complex number from the given real and imaginary parts.
4038 pub fn init(re: T, im: T) Self {
4139 return Self{
lib/std/mem.zig-10
......@@ -702,8 +702,6 @@ test "span" {
702702 try testing.expectEqual(@as(?[:0]u16, null), span(@as(?[*:0]u16, null)));
703703}
704704
705pub const spanZ = @compileError("deprecated; use use std.mem.span() or std.mem.sliceTo()");
706
707705/// Helper for the return type of sliceTo()
708706fn SliceTo(comptime T: type, comptime end: meta.Elem(T)) type {
709707 switch (@typeInfo(T)) {
......@@ -957,8 +955,6 @@ test "len" {
957955 }
958956}
959957
960pub const lenZ = @compileError("deprecated; use std.mem.len() or std.mem.sliceTo().len");
961
962958pub fn indexOfSentinel(comptime Elem: type, comptime sentinel: Elem, ptr: [*:sentinel]const Elem) usize {
963959 var i: usize = 0;
964960 while (ptr[i] != sentinel) {
......@@ -975,9 +971,6 @@ pub fn allEqual(comptime T: type, slice: []const T, scalar: T) bool {
975971 return true;
976972}
977973
978pub const dupe = @compileError("deprecated; use `Allocator.dupe`");
979pub const dupeZ = @compileError("deprecated; use `Allocator.dupeZ`");
980
981974/// Remove values from the beginning of a slice.
982975pub fn trimLeft(comptime T: type, slice: []const T, values_to_strip: []const T) []const T {
983976 var begin: usize = 0;
......@@ -1567,9 +1560,6 @@ test "writeIntBig and writeIntLittle" {
15671560 try testing.expect(eql(u8, buf2[0..], &[_]u8{ 0xfc, 0xff }));
15681561}
15691562
1570/// TODO delete this deprecated declaration after 0.10.0 is released
1571pub const bswapAllFields = @compileError("bswapAllFields has been renamed to byteSwapAllFields");
1572
15731563/// Swap the byte order of all the members of the fields of a struct
15741564/// (Changing their endianess)
15751565pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {
lib/std/multi_array_list.zig-2
......@@ -334,8 +334,6 @@ pub fn MultiArrayList(comptime S: type) type {
334334 self.len = new_len;
335335 }
336336
337 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
338
339337 /// Modify the array so that it can hold at least `new_capacity` items.
340338 /// Implements super-linear growth to achieve amortized O(1) append operations.
341339 /// Invalidates pointers if additional memory is needed.
lib/std/priority_dequeue.zig-2
......@@ -357,8 +357,6 @@ pub fn PriorityDequeue(comptime T: type, comptime Context: type, comptime compar
357357 return queue;
358358 }
359359
360 pub const ensureCapacity = @compileError("deprecated; call `ensureUnusedCapacity` or `ensureTotalCapacity`");
361
362360 /// Ensure that the dequeue can fit at least `new_capacity` items.
363361 pub fn ensureTotalCapacity(self: *Self, new_capacity: usize) !void {
364362 var better_capacity = self.capacity();
lib/std/priority_queue.zig-2
......@@ -185,8 +185,6 @@ pub fn PriorityQueue(comptime T: type, comptime Context: type, comptime compareF
185185 return queue;
186186 }
187187
188 pub const ensureCapacity = @compileError("deprecated; use ensureUnusedCapacity or ensureTotalCapacity");
189
190188 /// Ensure that the queue can fit at least `new_capacity` items.
191189 pub fn ensureTotalCapacity(self: *Self, new_capacity: usize) !void {
192190 var better_capacity = self.capacity();
src/Autodoc.zig+2-2
......@@ -531,7 +531,7 @@ const DocData = struct {
531531 Int: struct { name: []const u8 },
532532 Float: struct { name: []const u8 },
533533 Pointer: struct {
534 size: std.builtin.TypeInfo.Pointer.Size,
534 size: std.builtin.Type.Pointer.Size,
535535 child: Expr,
536536 sentinel: ?Expr = null,
537537 @"align": ?Expr = null,
......@@ -641,7 +641,7 @@ const DocData = struct {
641641 const current_value = @field(self, case.name);
642642 inline for (comptime std.meta.fields(case.field_type)) |f| {
643643 try jsw.arrayElem();
644 if (f.field_type == std.builtin.TypeInfo.Pointer.Size) {
644 if (f.field_type == std.builtin.Type.Pointer.Size) {
645645 try jsw.emitNumber(@enumToInt(@field(current_value, f.name)));
646646 } else {
647647 try std.json.stringify(@field(current_value, f.name), opts, w);