Skip to content

Commit 8960990

Browse files
committed
std: Remove a handful of things deprecated during the 0.15 release cycle
- std.Build.Step.Compile.root_module mutators -> std.Build.Module - std.Build.Step.Compile.want_lto -> std.Build.Step.Compile.lto - std.Build.Step.ConfigHeader.getOutput -> std.Build.Step.ConfigHeader.getOutputFile - std.Build.Step.Run.max_stdio_size -> std.Build.Step.Run.stdio_limit - std.enums.nameCast -> @field(E, tag_name) / @field(E, @TagName(tag)) - std.Io.tty.detectConfig -> std.Io.tty.Config.detect - std.mem.trimLeft -> std.mem.trimStart - std.mem.trimRight -> std.mem.trimEnd - std.meta.intToEnum -> std.enums.fromInt - std.meta.TagPayload -> @FieldType(U, @TagName(tag)) - std.meta.TagPayloadByName -> @FieldType(U, tag_name)
1 parent df5f937 commit 8960990

File tree

21 files changed

+42
-280
lines changed

21 files changed

+42
-280
lines changed

lib/compiler/aro/assembly_backend/x86_64.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn serializeFloat(comptime T: type, value: T, w: *std.Io.Writer) !void {
5858
},
5959
else => {
6060
const size = @bitSizeOf(T);
61-
const storage_unit = std.meta.intToEnum(StorageUnit, size) catch unreachable;
61+
const storage_unit = std.enums.fromInt(StorageUnit, size).?;
6262
const IntTy = @Type(.{ .int = .{ .signedness = .unsigned, .bits = size } });
6363
const int_val: IntTy = @bitCast(value);
6464
return serializeInt(int_val, storage_unit, w);
@@ -95,7 +95,7 @@ fn emitSingleValue(c: *AsmCodeGen, qt: QualType, node: Node.Index) !void {
9595
if (!scalar_kind.isReal()) {
9696
return c.todo("Codegen _Complex values", node.tok(c.tree));
9797
} else if (scalar_kind.isInt()) {
98-
const storage_unit = std.meta.intToEnum(StorageUnit, bit_size) catch return c.todo("Codegen _BitInt values", node.tok(c.tree));
98+
const storage_unit = std.enums.fromInt(StorageUnit, bit_size) orelse return c.todo("Codegen _BitInt values", node.tok(c.tree));
9999
try c.data.print(" .{s} ", .{@tagName(storage_unit)});
100100
_ = try value.print(qt, c.comp, c.data);
101101
try c.data.writeByte('\n');

lib/docs/wasm/markdown.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn mainImpl() !void {
149149
var stdin_reader = std.fs.File.stdin().reader(&stdin_buffer);
150150

151151
while (stdin_reader.takeDelimiterExclusive('\n')) |line| {
152-
const trimmed = std.mem.trimRight(u8, line, '\r');
152+
const trimmed = std.mem.trimEnd(u8, line, '\r');
153153
try parser.feedLine(trimmed);
154154
} else |err| switch (err) {
155155
error.EndOfStream => {},

lib/std/Build/Step/Compile.zig

Lines changed: 2 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ force_undefined_symbols: std.StringHashMap(void),
187187
/// Overrides the default stack size
188188
stack_size: ?u64 = null,
189189

190-
/// Deprecated; prefer using `lto`.
191-
want_lto: ?bool = null,
192-
193190
use_llvm: ?bool,
194191
use_lld: ?bool,
195192
use_new_linker: ?bool,
@@ -539,7 +536,7 @@ pub fn installHeadersDirectory(
539536
/// When a module links with this artifact, all headers marked for installation are added to that
540537
/// module's include search path.
541538
pub fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader) void {
542-
cs.installHeader(config_header.getOutput(), config_header.include_path);
539+
cs.installHeader(config_header.getOutputFile(), config_header.include_path);
543540
}
544541

545542
/// Forwards all headers marked for installation from `lib` to this artifact.
@@ -682,18 +679,6 @@ pub fn producesImplib(compile: *Compile) bool {
682679
return compile.isDll();
683680
}
684681

685-
/// Deprecated; use `compile.root_module.link_libc = true` instead.
686-
/// To be removed after 0.15.0 is tagged.
687-
pub fn linkLibC(compile: *Compile) void {
688-
compile.root_module.link_libc = true;
689-
}
690-
691-
/// Deprecated; use `compile.root_module.link_libcpp = true` instead.
692-
/// To be removed after 0.15.0 is tagged.
693-
pub fn linkLibCpp(compile: *Compile) void {
694-
compile.root_module.link_libcpp = true;
695-
}
696-
697682
const PkgConfigResult = struct {
698683
cflags: []const []const u8,
699684
libs: []const []const u8,
@@ -807,46 +792,6 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult {
807792
};
808793
}
809794

810-
/// Deprecated; use `compile.root_module.linkSystemLibrary(name, .{})` instead.
811-
/// To be removed after 0.15.0 is tagged.
812-
pub fn linkSystemLibrary(compile: *Compile, name: []const u8) void {
813-
return compile.root_module.linkSystemLibrary(name, .{});
814-
}
815-
816-
/// Deprecated; use `compile.root_module.linkSystemLibrary(name, options)` instead.
817-
/// To be removed after 0.15.0 is tagged.
818-
pub fn linkSystemLibrary2(
819-
compile: *Compile,
820-
name: []const u8,
821-
options: Module.LinkSystemLibraryOptions,
822-
) void {
823-
return compile.root_module.linkSystemLibrary(name, options);
824-
}
825-
826-
/// Deprecated; use `c.root_module.linkFramework(name, .{})` instead.
827-
/// To be removed after 0.15.0 is tagged.
828-
pub fn linkFramework(c: *Compile, name: []const u8) void {
829-
c.root_module.linkFramework(name, .{});
830-
}
831-
832-
/// Deprecated; use `compile.root_module.addCSourceFiles(options)` instead.
833-
/// To be removed after 0.15.0 is tagged.
834-
pub fn addCSourceFiles(compile: *Compile, options: Module.AddCSourceFilesOptions) void {
835-
compile.root_module.addCSourceFiles(options);
836-
}
837-
838-
/// Deprecated; use `compile.root_module.addCSourceFile(source)` instead.
839-
/// To be removed after 0.15.0 is tagged.
840-
pub fn addCSourceFile(compile: *Compile, source: Module.CSourceFile) void {
841-
compile.root_module.addCSourceFile(source);
842-
}
843-
844-
/// Deprecated; use `compile.root_module.addWin32ResourceFile(source)` instead.
845-
/// To be removed after 0.15.0 is tagged.
846-
pub fn addWin32ResourceFile(compile: *Compile, source: Module.RcSourceFile) void {
847-
compile.root_module.addWin32ResourceFile(source);
848-
}
849-
850795
pub fn setVerboseLink(compile: *Compile, value: bool) void {
851796
compile.verbose_link = value;
852797
}
@@ -928,84 +873,6 @@ pub fn getEmittedLlvmBc(compile: *Compile) LazyPath {
928873
return compile.getEmittedFileGeneric(&compile.generated_llvm_bc);
929874
}
930875

931-
/// Deprecated; use `compile.root_module.addAssemblyFile(source)` instead.
932-
/// To be removed after 0.15.0 is tagged.
933-
pub fn addAssemblyFile(compile: *Compile, source: LazyPath) void {
934-
compile.root_module.addAssemblyFile(source);
935-
}
936-
937-
/// Deprecated; use `compile.root_module.addObjectFile(source)` instead.
938-
/// To be removed after 0.15.0 is tagged.
939-
pub fn addObjectFile(compile: *Compile, source: LazyPath) void {
940-
compile.root_module.addObjectFile(source);
941-
}
942-
943-
/// Deprecated; use `compile.root_module.addObject(object)` instead.
944-
/// To be removed after 0.15.0 is tagged.
945-
pub fn addObject(compile: *Compile, object: *Compile) void {
946-
compile.root_module.addObject(object);
947-
}
948-
949-
/// Deprecated; use `compile.root_module.linkLibrary(library)` instead.
950-
/// To be removed after 0.15.0 is tagged.
951-
pub fn linkLibrary(compile: *Compile, library: *Compile) void {
952-
compile.root_module.linkLibrary(library);
953-
}
954-
955-
/// Deprecated; use `compile.root_module.addAfterIncludePath(lazy_path)` instead.
956-
/// To be removed after 0.15.0 is tagged.
957-
pub fn addAfterIncludePath(compile: *Compile, lazy_path: LazyPath) void {
958-
compile.root_module.addAfterIncludePath(lazy_path);
959-
}
960-
961-
/// Deprecated; use `compile.root_module.addSystemIncludePath(lazy_path)` instead.
962-
/// To be removed after 0.15.0 is tagged.
963-
pub fn addSystemIncludePath(compile: *Compile, lazy_path: LazyPath) void {
964-
compile.root_module.addSystemIncludePath(lazy_path);
965-
}
966-
967-
/// Deprecated; use `compile.root_module.addIncludePath(lazy_path)` instead.
968-
/// To be removed after 0.15.0 is tagged.
969-
pub fn addIncludePath(compile: *Compile, lazy_path: LazyPath) void {
970-
compile.root_module.addIncludePath(lazy_path);
971-
}
972-
973-
/// Deprecated; use `compile.root_module.addConfigHeader(config_header)` instead.
974-
/// To be removed after 0.15.0 is tagged.
975-
pub fn addConfigHeader(compile: *Compile, config_header: *Step.ConfigHeader) void {
976-
compile.root_module.addConfigHeader(config_header);
977-
}
978-
979-
/// Deprecated; use `compile.root_module.addEmbedPath(lazy_path)` instead.
980-
/// To be removed after 0.15.0 is tagged.
981-
pub fn addEmbedPath(compile: *Compile, lazy_path: LazyPath) void {
982-
compile.root_module.addEmbedPath(lazy_path);
983-
}
984-
985-
/// Deprecated; use `compile.root_module.addLibraryPath(directory_path)` instead.
986-
/// To be removed after 0.15.0 is tagged.
987-
pub fn addLibraryPath(compile: *Compile, directory_path: LazyPath) void {
988-
compile.root_module.addLibraryPath(directory_path);
989-
}
990-
991-
/// Deprecated; use `compile.root_module.addRPath(directory_path)` instead.
992-
/// To be removed after 0.15.0 is tagged.
993-
pub fn addRPath(compile: *Compile, directory_path: LazyPath) void {
994-
compile.root_module.addRPath(directory_path);
995-
}
996-
997-
/// Deprecated; use `compile.root_module.addSystemFrameworkPath(directory_path)` instead.
998-
/// To be removed after 0.15.0 is tagged.
999-
pub fn addSystemFrameworkPath(compile: *Compile, directory_path: LazyPath) void {
1000-
compile.root_module.addSystemFrameworkPath(directory_path);
1001-
}
1002-
1003-
/// Deprecated; use `compile.root_module.addFrameworkPath(directory_path)` instead.
1004-
/// To be removed after 0.15.0 is tagged.
1005-
pub fn addFrameworkPath(compile: *Compile, directory_path: LazyPath) void {
1006-
compile.root_module.addFrameworkPath(directory_path);
1007-
}
1008-
1009876
pub fn setExecCmd(compile: *Compile, args: []const ?[]const u8) void {
1010877
const b = compile.step.owner;
1011878
assert(compile.kind == .@"test");
@@ -1758,7 +1625,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
17581625
.thin => "-flto=thin",
17591626
.none => "-fno-lto",
17601627
});
1761-
} else try addFlag(&zig_args, "lto", compile.want_lto);
1628+
}
17621629

17631630
try addFlag(&zig_args, "sanitize-coverage-trace-pc-guard", compile.sanitize_coverage_trace_pc_guard);
17641631

lib/std/Build/Step/ConfigHeader.zig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ pub fn getOutputFile(ch: *ConfigHeader) std.Build.LazyPath {
124124
return ch.getOutputDir().path(ch.step.owner, ch.include_path);
125125
}
126126

127-
/// Deprecated; use `getOutputFile`.
128-
pub const getOutput = getOutputFile;
129-
130127
fn addValueInner(config_header: *ConfigHeader, name: []const u8, comptime T: type, value: T) !void {
131128
switch (@typeInfo(T)) {
132129
.null => {

lib/std/Build/Step/Run.zig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ skip_foreign_checks: bool,
7373
/// external executor (such as qemu) but not fail if the executor is unavailable.
7474
failing_to_execute_foreign_is_an_error: bool,
7575

76-
/// Deprecated in favor of `stdio_limit`.
77-
max_stdio_size: usize,
78-
7976
/// If stderr or stdout exceeds this amount, the child process is killed and
8077
/// the step fails.
8178
stdio_limit: std.Io.Limit,
@@ -208,7 +205,6 @@ pub fn create(owner: *std.Build, name: []const u8) *Run {
208205
.rename_step_with_output_arg = true,
209206
.skip_foreign_checks = false,
210207
.failing_to_execute_foreign_is_an_error = true,
211-
.max_stdio_size = 10 * 1024 * 1024,
212208
.stdio_limit = .unlimited,
213209
.captured_stdout = null,
214210
.captured_stderr = null,
@@ -2145,7 +2141,6 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult {
21452141
var stdout_bytes: ?[]const u8 = null;
21462142
var stderr_bytes: ?[]const u8 = null;
21472143

2148-
run.stdio_limit = run.stdio_limit.min(.limited(run.max_stdio_size));
21492144
if (child.stdout) |stdout| {
21502145
if (child.stderr) |stderr| {
21512146
var poller = std.Io.poll(arena, enum { stdout, stderr }, .{

lib/std/Io/Reader.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ pub const TakeEnumError = Error || error{InvalidEnumTag};
12461246
pub fn takeEnum(r: *Reader, comptime Enum: type, endian: std.builtin.Endian) TakeEnumError!Enum {
12471247
const Tag = @typeInfo(Enum).@"enum".tag_type;
12481248
const int = try r.takeInt(Tag, endian);
1249-
return std.meta.intToEnum(Enum, int);
1249+
return std.enums.fromInt(Enum, int) orelse return error.InvalidEnumTag;
12501250
}
12511251

12521252
/// Reads an integer with the same size as the given nonexhaustive enum's tag type.

lib/std/Io/Writer.zig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,10 +1201,6 @@ pub fn printValue(
12011201
}
12021202

12031203
const is_any = comptime std.mem.eql(u8, fmt, ANY);
1204-
if (!is_any and std.meta.hasMethod(T, "format") and fmt.len == 0) {
1205-
// after 0.15.0 is tagged, delete this compile error and its condition
1206-
@compileError("ambiguous format string; specify {f} to call format method, or {any} to skip it");
1207-
}
12081204

12091205
switch (@typeInfo(T)) {
12101206
.float, .comptime_float => {
@@ -1692,7 +1688,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi
16921688

16931689
try w.writeAll("0x");
16941690
try w.writeByte(buf[0]);
1695-
const trimmed = std.mem.trimRight(u8, buf[1..], "0");
1691+
const trimmed = std.mem.trimEnd(u8, buf[1..], "0");
16961692
if (opt_precision) |precision| {
16971693
if (precision > 0) try w.writeAll(".");
16981694
} else if (trimmed.len > 0) {

lib/std/Io/tty.zig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ const process = std.process;
55
const windows = std.os.windows;
66
const native_os = builtin.os.tag;
77

8-
/// Deprecated in favor of `Config.detect`.
9-
pub fn detectConfig(file: File) Config {
10-
return .detect(file);
11-
}
12-
138
pub const Color = enum {
149
black,
1510
red,

lib/std/crypto/tls/Client.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ fn readIndirect(c: *Client) Reader.Error!usize {
11581158
P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, pv.server_key) catch
11591159
return failRead(c, error.TlsBadRecordMac);
11601160
// TODO use scalar, non-slice version
1161-
const msg = mem.trimRight(u8, cleartext, "\x00");
1161+
const msg = mem.trimEnd(u8, cleartext, "\x00");
11621162
break :cleartext .{ msg.len - 1, @enumFromInt(msg[msg.len - 1]) };
11631163
},
11641164
.tls_1_2 => {

lib/std/debug.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,16 @@ pub fn dumpHex(bytes: []const u8) void {
328328
}
329329

330330
/// Prints a hexadecimal view of the bytes, returning any error that occurs.
331-
pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !void {
331+
pub fn dumpHexFallible(bw: *Writer, tty_config: tty.Config, bytes: []const u8) !void {
332332
var chunks = mem.window(u8, bytes, 16, 16);
333333
while (chunks.next()) |window| {
334334
// 1. Print the address.
335335
const address = (@intFromPtr(bytes.ptr) + 0x10 * (std.math.divCeil(usize, chunks.index orelse bytes.len, 16) catch unreachable)) - 0x10;
336-
try ttyconf.setColor(bw, .dim);
336+
try tty_config.setColor(bw, .dim);
337337
// We print the address in lowercase and the bytes in uppercase hexadecimal to distinguish them more.
338338
// Also, make sure all lines are aligned by padding the address.
339339
try bw.print("{x:0>[1]} ", .{ address, @sizeOf(usize) * 2 });
340-
try ttyconf.setColor(bw, .reset);
340+
try tty_config.setColor(bw, .reset);
341341

342342
// 2. Print the bytes.
343343
for (window, 0..) |byte, index| {
@@ -357,7 +357,7 @@ pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !voi
357357
try bw.writeByte(byte);
358358
} else {
359359
// Related: https://github.com/ziglang/zig/issues/7600
360-
if (ttyconf == .windows_api) {
360+
if (tty_config == .windows_api) {
361361
try bw.writeByte('.');
362362
continue;
363363
}

0 commit comments

Comments
 (0)