Remove numerous things deprecated during the 0.14 release cycle

Basically everything that has a direct replacement or no uses left.

Notable omissions:

- std.ArrayHashMap: Too much fallout, needs a separate cleanup.
- std.debug.runtime_safety: Too much fallout.
- std.heap.GeneralPurposeAllocator: Lots of references to it remain, not
  a simple find and replace as "debug allocator" is not equivalent to
  "general purpose allocator".
- std.io.Reader: Is being reworked at the moment.
- std.unicode.utf8Decode(): No replacement, needs a new API first.
- Manifest backwards compat options: Removal would break test data used
  by TestFetchBuilder.
- panic handler needs to be a namespace: Many tests still rely on it
  being a function, needs a separate cleanup.
This commit is contained in:
Linus Groh 2025-03-05 03:17:54 +00:00 committed by Andrew Kelley
parent d83b95cbf4
commit eb37552536
62 changed files with 128 additions and 642 deletions

View File

@ -1,7 +1,8 @@
const std = @import("std"); const std = @import("std");
pub fn build(b: *std.Build) void { pub fn build(b: *std.Build) void {
const lib = b.addSharedLibrary(.{ const lib = b.addLibrary(.{
.linkage = .dynamic,
.name = "mathtest", .name = "mathtest",
.root_source_file = b.path("mathtest.zig"), .root_source_file = b.path("mathtest.zig"),
.version = .{ .major = 1, .minor = 0, .patch = 0 }, .version = .{ .major = 1, .minor = 0, .patch = 0 },

View File

@ -3,7 +3,7 @@ const builtin = @import("builtin");
const native_arch = builtin.cpu.arch; const native_arch = builtin.cpu.arch;
const expect = std.testing.expect; const expect = std.testing.expect;
const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall else .C; const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .{ .x86_stdcall = .{} } else .c;
extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn; extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn;
test "foo" { test "foo" {

View File

@ -8259,7 +8259,7 @@ fn charLiteral(p: *Parser) Error!Result {
const slice = char_kind.contentSlice(p.tokSlice(p.tok_i)); const slice = char_kind.contentSlice(p.tokSlice(p.tok_i));
var is_multichar = false; var is_multichar = false;
if (slice.len == 1 and std.ascii.isASCII(slice[0])) { if (slice.len == 1 and std.ascii.isAscii(slice[0])) {
// fast path: single unescaped ASCII char // fast path: single unescaped ASCII char
val = slice[0]; val = slice[0];
} else { } else {

View File

@ -1820,7 +1820,7 @@ pub fn main() !void {
var tree = translate(gpa, &aro_comp, args) catch |err| switch (err) { var tree = translate(gpa, &aro_comp, args) catch |err| switch (err) {
error.ParsingFailed, error.FatalError => renderErrorsAndExit(&aro_comp), error.ParsingFailed, error.FatalError => renderErrorsAndExit(&aro_comp),
error.OutOfMemory => return error.OutOfMemory, error.OutOfMemory => return error.OutOfMemory,
error.StreamTooLong => std.zig.fatal("An input file was larger than 4GiB", .{}), error.StreamTooLong => std.process.fatal("An input file was larger than 4GiB", .{}),
}; };
defer tree.deinit(gpa); defer tree.deinit(gpa);

View File

@ -7,7 +7,7 @@ const Allocator = std.mem.Allocator;
const File = std.fs.File; const File = std.fs.File;
const assert = std.debug.assert; const assert = std.debug.assert;
const fatal = std.zig.fatal; const fatal = std.process.fatal;
const Server = std.zig.Server; const Server = std.zig.Server;
pub fn main() !void { pub fn main() !void {

View File

@ -692,6 +692,7 @@ pub fn addOptions(b: *Build) *Step.Options {
pub const ExecutableOptions = struct { pub const ExecutableOptions = struct {
name: []const u8, name: []const u8,
root_module: *Module,
version: ?std.SemanticVersion = null, version: ?std.SemanticVersion = null,
linkage: ?std.builtin.LinkMode = null, linkage: ?std.builtin.LinkMode = null,
max_rss: usize = 0, max_rss: usize = 0,
@ -704,58 +705,12 @@ pub const ExecutableOptions = struct {
/// Can be set regardless of target. The `.manifest` file will be ignored /// Can be set regardless of target. The `.manifest` file will be ignored
/// if the target object format does not support embedded manifests. /// if the target object format does not support embedded manifests.
win32_manifest: ?LazyPath = null, win32_manifest: ?LazyPath = null,
/// Prefer populating this field (using e.g. `createModule`) instead of populating
/// the following fields (`root_source_file` etc). In a future release, those fields
/// will be removed, and this field will become non-optional.
root_module: ?*Module = null,
/// Deprecated; prefer populating `root_module`.
root_source_file: ?LazyPath = null,
/// Deprecated; prefer populating `root_module`.
target: ?ResolvedTarget = null,
/// Deprecated; prefer populating `root_module`.
optimize: std.builtin.OptimizeMode = .Debug,
/// Deprecated; prefer populating `root_module`.
code_model: std.builtin.CodeModel = .default,
/// Deprecated; prefer populating `root_module`.
link_libc: ?bool = null,
/// Deprecated; prefer populating `root_module`.
single_threaded: ?bool = null,
/// Deprecated; prefer populating `root_module`.
pic: ?bool = null,
/// Deprecated; prefer populating `root_module`.
strip: ?bool = null,
/// Deprecated; prefer populating `root_module`.
unwind_tables: ?std.builtin.UnwindTables = null,
/// Deprecated; prefer populating `root_module`.
omit_frame_pointer: ?bool = null,
/// Deprecated; prefer populating `root_module`.
sanitize_thread: ?bool = null,
/// Deprecated; prefer populating `root_module`.
error_tracing: ?bool = null,
}; };
pub fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile { pub fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile {
if (options.root_module != null and options.target != null) {
@panic("`root_module` and `target` cannot both be populated");
}
return .create(b, .{ return .create(b, .{
.name = options.name, .name = options.name,
.root_module = options.root_module orelse b.createModule(.{ .root_module = options.root_module,
.root_source_file = options.root_source_file,
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
.optimize = options.optimize,
.link_libc = options.link_libc,
.single_threaded = options.single_threaded,
.pic = options.pic,
.strip = options.strip,
.unwind_tables = options.unwind_tables,
.omit_frame_pointer = options.omit_frame_pointer,
.sanitize_thread = options.sanitize_thread,
.error_tracing = options.error_tracing,
.code_model = options.code_model,
}),
.version = options.version, .version = options.version,
.kind = .exe, .kind = .exe,
.linkage = options.linkage, .linkage = options.linkage,
@ -769,62 +724,17 @@ pub fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile {
pub const ObjectOptions = struct { pub const ObjectOptions = struct {
name: []const u8, name: []const u8,
root_module: *Module,
max_rss: usize = 0, max_rss: usize = 0,
use_llvm: ?bool = null, use_llvm: ?bool = null,
use_lld: ?bool = null, use_lld: ?bool = null,
zig_lib_dir: ?LazyPath = null, zig_lib_dir: ?LazyPath = null,
/// Prefer populating this field (using e.g. `createModule`) instead of populating
/// the following fields (`root_source_file` etc). In a future release, those fields
/// will be removed, and this field will become non-optional.
root_module: ?*Module = null,
/// Deprecated; prefer populating `root_module`.
root_source_file: ?LazyPath = null,
/// Deprecated; prefer populating `root_module`.
target: ?ResolvedTarget = null,
/// Deprecated; prefer populating `root_module`.
optimize: std.builtin.OptimizeMode = .Debug,
/// Deprecated; prefer populating `root_module`.
code_model: std.builtin.CodeModel = .default,
/// Deprecated; prefer populating `root_module`.
link_libc: ?bool = null,
/// Deprecated; prefer populating `root_module`.
single_threaded: ?bool = null,
/// Deprecated; prefer populating `root_module`.
pic: ?bool = null,
/// Deprecated; prefer populating `root_module`.
strip: ?bool = null,
/// Deprecated; prefer populating `root_module`.
unwind_tables: ?std.builtin.UnwindTables = null,
/// Deprecated; prefer populating `root_module`.
omit_frame_pointer: ?bool = null,
/// Deprecated; prefer populating `root_module`.
sanitize_thread: ?bool = null,
/// Deprecated; prefer populating `root_module`.
error_tracing: ?bool = null,
}; };
pub fn addObject(b: *Build, options: ObjectOptions) *Step.Compile { pub fn addObject(b: *Build, options: ObjectOptions) *Step.Compile {
if (options.root_module != null and options.target != null) {
@panic("`root_module` and `target` cannot both be populated");
}
return .create(b, .{ return .create(b, .{
.name = options.name, .name = options.name,
.root_module = options.root_module orelse b.createModule(.{ .root_module = options.root_module,
.root_source_file = options.root_source_file,
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
.optimize = options.optimize,
.link_libc = options.link_libc,
.single_threaded = options.single_threaded,
.pic = options.pic,
.strip = options.strip,
.unwind_tables = options.unwind_tables,
.omit_frame_pointer = options.omit_frame_pointer,
.sanitize_thread = options.sanitize_thread,
.error_tracing = options.error_tracing,
.code_model = options.code_model,
}),
.kind = .obj, .kind = .obj,
.max_rss = options.max_rss, .max_rss = options.max_rss,
.use_llvm = options.use_llvm, .use_llvm = options.use_llvm,
@ -833,153 +743,6 @@ pub fn addObject(b: *Build, options: ObjectOptions) *Step.Compile {
}); });
} }
pub const SharedLibraryOptions = struct {
name: []const u8,
version: ?std.SemanticVersion = null,
max_rss: usize = 0,
use_llvm: ?bool = null,
use_lld: ?bool = null,
zig_lib_dir: ?LazyPath = null,
/// Embed a `.manifest` file in the compilation if the object format supports it.
/// https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-files-reference
/// Manifest files must have the extension `.manifest`.
/// Can be set regardless of target. The `.manifest` file will be ignored
/// if the target object format does not support embedded manifests.
win32_manifest: ?LazyPath = null,
/// Prefer populating this field (using e.g. `createModule`) instead of populating
/// the following fields (`root_source_file` etc). In a future release, those fields
/// will be removed, and this field will become non-optional.
root_module: ?*Module = null,
/// Deprecated; prefer populating `root_module`.
root_source_file: ?LazyPath = null,
/// Deprecated; prefer populating `root_module`.
target: ?ResolvedTarget = null,
/// Deprecated; prefer populating `root_module`.
optimize: std.builtin.OptimizeMode = .Debug,
/// Deprecated; prefer populating `root_module`.
code_model: std.builtin.CodeModel = .default,
/// Deprecated; prefer populating `root_module`.
link_libc: ?bool = null,
/// Deprecated; prefer populating `root_module`.
single_threaded: ?bool = null,
/// Deprecated; prefer populating `root_module`.
pic: ?bool = null,
/// Deprecated; prefer populating `root_module`.
strip: ?bool = null,
/// Deprecated; prefer populating `root_module`.
unwind_tables: ?std.builtin.UnwindTables = null,
/// Deprecated; prefer populating `root_module`.
omit_frame_pointer: ?bool = null,
/// Deprecated; prefer populating `root_module`.
sanitize_thread: ?bool = null,
/// Deprecated; prefer populating `root_module`.
error_tracing: ?bool = null,
};
/// Deprecated: use `b.addLibrary(.{ ..., .linkage = .dynamic })` instead.
pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *Step.Compile {
if (options.root_module != null and options.target != null) {
@panic("`root_module` and `target` cannot both be populated");
}
return .create(b, .{
.name = options.name,
.root_module = options.root_module orelse b.createModule(.{
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
.optimize = options.optimize,
.root_source_file = options.root_source_file,
.link_libc = options.link_libc,
.single_threaded = options.single_threaded,
.pic = options.pic,
.strip = options.strip,
.unwind_tables = options.unwind_tables,
.omit_frame_pointer = options.omit_frame_pointer,
.sanitize_thread = options.sanitize_thread,
.error_tracing = options.error_tracing,
.code_model = options.code_model,
}),
.kind = .lib,
.linkage = .dynamic,
.version = options.version,
.max_rss = options.max_rss,
.use_llvm = options.use_llvm,
.use_lld = options.use_lld,
.zig_lib_dir = options.zig_lib_dir,
.win32_manifest = options.win32_manifest,
});
}
pub const StaticLibraryOptions = struct {
name: []const u8,
version: ?std.SemanticVersion = null,
max_rss: usize = 0,
use_llvm: ?bool = null,
use_lld: ?bool = null,
zig_lib_dir: ?LazyPath = null,
/// Prefer populating this field (using e.g. `createModule`) instead of populating
/// the following fields (`root_source_file` etc). In a future release, those fields
/// will be removed, and this field will become non-optional.
root_module: ?*Module = null,
/// Deprecated; prefer populating `root_module`.
root_source_file: ?LazyPath = null,
/// Deprecated; prefer populating `root_module`.
target: ?ResolvedTarget = null,
/// Deprecated; prefer populating `root_module`.
optimize: std.builtin.OptimizeMode = .Debug,
/// Deprecated; prefer populating `root_module`.
code_model: std.builtin.CodeModel = .default,
/// Deprecated; prefer populating `root_module`.
link_libc: ?bool = null,
/// Deprecated; prefer populating `root_module`.
single_threaded: ?bool = null,
/// Deprecated; prefer populating `root_module`.
pic: ?bool = null,
/// Deprecated; prefer populating `root_module`.
strip: ?bool = null,
/// Deprecated; prefer populating `root_module`.
unwind_tables: ?std.builtin.UnwindTables = null,
/// Deprecated; prefer populating `root_module`.
omit_frame_pointer: ?bool = null,
/// Deprecated; prefer populating `root_module`.
sanitize_thread: ?bool = null,
/// Deprecated; prefer populating `root_module`.
error_tracing: ?bool = null,
};
/// Deprecated: use `b.addLibrary(.{ ..., .linkage = .static })` instead.
pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *Step.Compile {
if (options.root_module != null and options.target != null) {
@panic("`root_module` and `target` cannot both be populated");
}
return .create(b, .{
.name = options.name,
.root_module = options.root_module orelse b.createModule(.{
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
.optimize = options.optimize,
.root_source_file = options.root_source_file,
.link_libc = options.link_libc,
.single_threaded = options.single_threaded,
.pic = options.pic,
.strip = options.strip,
.unwind_tables = options.unwind_tables,
.omit_frame_pointer = options.omit_frame_pointer,
.sanitize_thread = options.sanitize_thread,
.error_tracing = options.error_tracing,
.code_model = options.code_model,
}),
.kind = .lib,
.linkage = .static,
.version = options.version,
.max_rss = options.max_rss,
.use_llvm = options.use_llvm,
.use_lld = options.use_lld,
.zig_lib_dir = options.zig_lib_dir,
});
}
pub const LibraryOptions = struct { pub const LibraryOptions = struct {
linkage: std.builtin.LinkMode = .static, linkage: std.builtin.LinkMode = .static,
name: []const u8, name: []const u8,
@ -1014,9 +777,8 @@ pub fn addLibrary(b: *Build, options: LibraryOptions) *Step.Compile {
pub const TestOptions = struct { pub const TestOptions = struct {
name: []const u8 = "test", name: []const u8 = "test",
root_module: *Module,
max_rss: usize = 0, max_rss: usize = 0,
/// Deprecated; use `.filters = &.{filter}` instead of `.filter = filter`.
filter: ?[]const u8 = null,
filters: []const []const u8 = &.{}, filters: []const []const u8 = &.{},
test_runner: ?Step.Compile.TestRunner = null, test_runner: ?Step.Compile.TestRunner = null,
use_llvm: ?bool = null, use_llvm: ?bool = null,
@ -1026,38 +788,6 @@ pub const TestOptions = struct {
/// The object must be linked separately. /// The object must be linked separately.
/// Usually used in conjunction with a custom `test_runner`. /// Usually used in conjunction with a custom `test_runner`.
emit_object: bool = false, emit_object: bool = false,
/// Prefer populating this field (using e.g. `createModule`) instead of populating
/// the following fields (`root_source_file` etc). In a future release, those fields
/// will be removed, and this field will become non-optional.
root_module: ?*Module = null,
/// Deprecated; prefer populating `root_module`.
root_source_file: ?LazyPath = null,
/// Deprecated; prefer populating `root_module`.
target: ?ResolvedTarget = null,
/// Deprecated; prefer populating `root_module`.
optimize: std.builtin.OptimizeMode = .Debug,
/// Deprecated; prefer populating `root_module`.
version: ?std.SemanticVersion = null,
/// Deprecated; prefer populating `root_module`.
link_libc: ?bool = null,
/// Deprecated; prefer populating `root_module`.
link_libcpp: ?bool = null,
/// Deprecated; prefer populating `root_module`.
single_threaded: ?bool = null,
/// Deprecated; prefer populating `root_module`.
pic: ?bool = null,
/// Deprecated; prefer populating `root_module`.
strip: ?bool = null,
/// Deprecated; prefer populating `root_module`.
unwind_tables: ?std.builtin.UnwindTables = null,
/// Deprecated; prefer populating `root_module`.
omit_frame_pointer: ?bool = null,
/// Deprecated; prefer populating `root_module`.
sanitize_thread: ?bool = null,
/// Deprecated; prefer populating `root_module`.
error_tracing: ?bool = null,
}; };
/// Creates an executable containing unit tests. /// Creates an executable containing unit tests.
@ -1069,33 +799,12 @@ pub const TestOptions = struct {
/// two steps are separated because they are independently configured and /// two steps are separated because they are independently configured and
/// cached. /// cached.
pub fn addTest(b: *Build, options: TestOptions) *Step.Compile { pub fn addTest(b: *Build, options: TestOptions) *Step.Compile {
if (options.root_module != null and options.root_source_file != null) {
@panic("`root_module` and `root_source_file` cannot both be populated");
}
return .create(b, .{ return .create(b, .{
.name = options.name, .name = options.name,
.kind = if (options.emit_object) .test_obj else .@"test", .kind = if (options.emit_object) .test_obj else .@"test",
.root_module = options.root_module orelse b.createModule(.{ .root_module = options.root_module,
.root_source_file = options.root_source_file orelse @panic("`root_module` and `root_source_file` cannot both be null"),
.target = options.target orelse b.graph.host,
.optimize = options.optimize,
.link_libc = options.link_libc,
.link_libcpp = options.link_libcpp,
.single_threaded = options.single_threaded,
.pic = options.pic,
.strip = options.strip,
.unwind_tables = options.unwind_tables,
.omit_frame_pointer = options.omit_frame_pointer,
.sanitize_thread = options.sanitize_thread,
.error_tracing = options.error_tracing,
}),
.max_rss = options.max_rss, .max_rss = options.max_rss,
.filters = if (options.filter != null and options.filters.len > 0) filters: { .filters = b.dupeStrings(options.filters),
const filters = b.allocator.alloc([]const u8, 1 + options.filters.len) catch @panic("OOM");
filters[0] = b.dupe(options.filter.?);
for (filters[1..], options.filters) |*dest, source| dest.* = b.dupe(source);
break :filters filters;
} else b.dupeStrings(if (options.filter) |filter| &.{filter} else options.filters),
.test_runner = options.test_runner, .test_runner = options.test_runner,
.use_llvm = options.use_llvm, .use_llvm = options.use_llvm,
.use_lld = options.use_lld, .use_lld = options.use_lld,
@ -1114,22 +823,6 @@ pub const AssemblyOptions = struct {
zig_lib_dir: ?LazyPath = null, zig_lib_dir: ?LazyPath = null,
}; };
/// Deprecated; prefer using `addObject` where the `root_module` has an empty
/// `root_source_file` and contains an assembly file via `Module.addAssemblyFile`.
pub fn addAssembly(b: *Build, options: AssemblyOptions) *Step.Compile {
const root_module = b.createModule(.{
.target = options.target,
.optimize = options.optimize,
});
root_module.addAssemblyFile(options.source_file);
return b.addObject(.{
.name = options.name,
.max_rss = options.max_rss,
.zig_lib_dir = options.zig_lib_dir,
.root_module = root_module,
});
}
/// This function creates a module and adds it to the package's module set, making /// This function creates a module and adds it to the package's module set, making
/// it available to other packages which depend on this one. /// it available to other packages which depend on this one.
/// `createModule` can be used instead to create a private module. /// `createModule` can be used instead to create a private module.

View File

@ -1326,7 +1326,7 @@ test "cache file and then recall it" {
// Wait for file timestamps to tick // Wait for file timestamps to tick
const initial_time = try testGetCurrentFileTimestamp(tmp.dir); const initial_time = try testGetCurrentFileTimestamp(tmp.dir);
while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time) { while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time) {
std.time.sleep(1); std.Thread.sleep(1);
} }
var digest1: HexDigest = undefined; var digest1: HexDigest = undefined;
@ -1389,7 +1389,7 @@ test "check that changing a file makes cache fail" {
// Wait for file timestamps to tick // Wait for file timestamps to tick
const initial_time = try testGetCurrentFileTimestamp(tmp.dir); const initial_time = try testGetCurrentFileTimestamp(tmp.dir);
while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time) { while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time) {
std.time.sleep(1); std.Thread.sleep(1);
} }
var digest1: HexDigest = undefined; var digest1: HexDigest = undefined;
@ -1501,7 +1501,7 @@ test "Manifest with files added after initial hash work" {
// Wait for file timestamps to tick // Wait for file timestamps to tick
const initial_time = try testGetCurrentFileTimestamp(tmp.dir); const initial_time = try testGetCurrentFileTimestamp(tmp.dir);
while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time) { while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time) {
std.time.sleep(1); std.Thread.sleep(1);
} }
var digest1: HexDigest = undefined; var digest1: HexDigest = undefined;
@ -1551,7 +1551,7 @@ test "Manifest with files added after initial hash work" {
// Wait for file timestamps to tick // Wait for file timestamps to tick
const initial_time2 = try testGetCurrentFileTimestamp(tmp.dir); const initial_time2 = try testGetCurrentFileTimestamp(tmp.dir);
while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time2) { while ((try testGetCurrentFileTimestamp(tmp.dir)) == initial_time2) {
std.time.sleep(1); std.Thread.sleep(1);
} }
{ {

View File

@ -8,9 +8,6 @@ pub const Style = union(enum) {
/// A configure format supported by autotools that uses `#undef foo` to /// A configure format supported by autotools that uses `#undef foo` to
/// mark lines that can be substituted with different values. /// mark lines that can be substituted with different values.
autoconf_undef: std.Build.LazyPath, autoconf_undef: std.Build.LazyPath,
/// Deprecated. Renamed to `autoconf_undef`.
/// To be removed after 0.14.0 is tagged.
autoconf: std.Build.LazyPath,
/// A configure format supported by autotools that uses `@FOO@` output variables. /// A configure format supported by autotools that uses `@FOO@` output variables.
autoconf_at: std.Build.LazyPath, autoconf_at: std.Build.LazyPath,
/// The configure format supported by CMake. It uses `@FOO@`, `${}` and /// The configure format supported by CMake. It uses `@FOO@`, `${}` and
@ -23,7 +20,7 @@ pub const Style = union(enum) {
pub fn getPath(style: Style) ?std.Build.LazyPath { pub fn getPath(style: Style) ?std.Build.LazyPath {
switch (style) { switch (style) {
.autoconf_undef, .autoconf, .autoconf_at, .cmake => |s| return s, .autoconf_undef, .autoconf_at, .cmake => |s| return s,
.blank, .nasm => return null, .blank, .nasm => return null,
} }
} }
@ -205,7 +202,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
const asm_generated_line = "; " ++ header_text ++ "\n"; const asm_generated_line = "; " ++ header_text ++ "\n";
switch (config_header.style) { switch (config_header.style) {
.autoconf_undef, .autoconf, .autoconf_at => |file_source| { .autoconf_undef, .autoconf_at => |file_source| {
try bw.writeAll(c_generated_line); try bw.writeAll(c_generated_line);
const src_path = file_source.getPath2(b, step); const src_path = file_source.getPath2(b, step);
const contents = std.fs.cwd().readFileAlloc(arena, src_path, config_header.max_bytes) catch |err| { const contents = std.fs.cwd().readFileAlloc(arena, src_path, config_header.max_bytes) catch |err| {
@ -214,7 +211,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
}); });
}; };
switch (config_header.style) { switch (config_header.style) {
.autoconf_undef, .autoconf => try render_autoconf_undef(step, contents, bw, config_header.values, src_path), .autoconf_undef => try render_autoconf_undef(step, contents, bw, config_header.values, src_path),
.autoconf_at => try render_autoconf_at(step, contents, &aw, config_header.values, src_path), .autoconf_at => try render_autoconf_at(step, contents, &aw, config_header.values, src_path),
else => unreachable, else => unreachable,
} }

View File

@ -63,19 +63,6 @@ pub fn getOutput(translate_c: *TranslateC) std.Build.LazyPath {
return .{ .generated = .{ .file = &translate_c.output_file } }; return .{ .generated = .{ .file = &translate_c.output_file } };
} }
/// Deprecated: use `createModule` or `addModule` with `std.Build.addExecutable` instead.
/// Creates a step to build an executable from the translated source.
pub fn addExecutable(translate_c: *TranslateC, options: AddExecutableOptions) *Step.Compile {
return translate_c.step.owner.addExecutable(.{
.root_source_file = translate_c.getOutput(),
.name = options.name orelse "translated_c",
.version = options.version,
.target = options.target orelse translate_c.target,
.optimize = options.optimize orelse translate_c.optimize,
.linkage = options.linkage,
});
}
/// Creates a module from the translated source and adds it to the package's /// Creates a module from the translated source and adds it to the package's
/// module set making it available to other packages which depend on this one. /// module set making it available to other packages which depend on this one.
/// `createModule` can be used instead to create a private module. /// `createModule` can be used instead to create a private module.

View File

@ -4,7 +4,7 @@ const Watch = @This();
const Step = std.Build.Step; const Step = std.Build.Step;
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const assert = std.debug.assert; const assert = std.debug.assert;
const fatal = std.zig.fatal; const fatal = std.process.fatal;
dir_table: DirTable, dir_table: DirTable,
os: Os, os: Os,

View File

@ -130,7 +130,7 @@ const SingleThreadedImpl = struct {
unreachable; // deadlock detected unreachable; // deadlock detected
}; };
std.time.sleep(timeout_ns); std.Thread.sleep(timeout_ns);
return error.Timeout; return error.Timeout;
} }
@ -348,7 +348,7 @@ test "wait and signal" {
} }
while (true) { while (true) {
std.time.sleep(100 * std.time.ns_per_ms); std.Thread.sleep(100 * std.time.ns_per_ms);
multi_wait.mutex.lock(); multi_wait.mutex.lock();
defer multi_wait.mutex.unlock(); defer multi_wait.mutex.unlock();
@ -405,7 +405,7 @@ test signal {
} }
while (true) { while (true) {
std.time.sleep(10 * std.time.ns_per_ms); std.Thread.sleep(10 * std.time.ns_per_ms);
signal_test.mutex.lock(); signal_test.mutex.lock();
defer signal_test.mutex.unlock(); defer signal_test.mutex.unlock();

View File

@ -116,7 +116,7 @@ const SingleThreadedImpl = struct {
unreachable; // deadlock detected unreachable; // deadlock detected
}; };
std.time.sleep(delay); std.Thread.sleep(delay);
return error.Timeout; return error.Timeout;
} }

View File

@ -74,7 +74,7 @@ const SingleThreadedImpl = struct {
unreachable; // deadlock detected unreachable; // deadlock detected
}; };
std.time.sleep(timeout_ns); std.Thread.sleep(timeout_ns);
return error.Timeout; return error.Timeout;
} }

View File

@ -181,9 +181,6 @@ pub fn isAscii(c: u8) bool {
return c < 128; return c < 128;
} }
/// Deprecated: use `isAscii`
pub const isASCII = isAscii;
/// Uppercases the character and returns it as-is if already uppercase or not a letter. /// Uppercases the character and returns it as-is if already uppercase or not a letter.
pub fn toUpper(c: u8) u8 { pub fn toUpper(c: u8) u8 {
const mask = @as(u8, @intFromBool(isLower(c))) << 5; const mask = @as(u8, @intFromBool(isLower(c))) << 5;

View File

@ -10,8 +10,6 @@ pub fn Value(comptime T: type) type {
return .{ .raw = value }; return .{ .raw = value };
} }
pub const fence = @compileError("@fence is deprecated, use other atomics to establish ordering");
pub inline fn load(self: *const Self, comptime order: AtomicOrder) T { pub inline fn load(self: *const Self, comptime order: AtomicOrder) T {
return @atomicLoad(T, &self.raw, order); return @atomicLoad(T, &self.raw, order);
} }

View File

@ -154,9 +154,6 @@ pub const OptimizeMode = enum {
ReleaseSmall, ReleaseSmall,
}; };
/// Deprecated; use OptimizeMode.
pub const Mode = OptimizeMode;
/// The calling convention of a function defines how arguments and return values are passed, as well /// The calling convention of a function defines how arguments and return values are passed, as well
/// as any other requirements which callers and callees must respect, such as register preservation /// as any other requirements which callers and callees must respect, such as register preservation
/// and stack alignment. /// and stack alignment.
@ -185,51 +182,6 @@ pub const CallingConvention = union(enum(u8)) {
else => unreachable, else => unreachable,
}; };
/// Deprecated; use `.auto`.
pub const Unspecified: CallingConvention = .auto;
/// Deprecated; use `.c`.
pub const C: CallingConvention = .c;
/// Deprecated; use `.naked`.
pub const Naked: CallingConvention = .naked;
/// Deprecated; use `.@"inline"`.
pub const Inline: CallingConvention = .@"inline";
/// Deprecated; use `.x86_64_interrupt`, `.x86_interrupt`, or `.avr_interrupt`.
pub const Interrupt: CallingConvention = switch (builtin.target.cpu.arch) {
.x86_64 => .{ .x86_64_interrupt = .{} },
.x86 => .{ .x86_interrupt = .{} },
.avr => .avr_interrupt,
else => unreachable,
};
/// Deprecated; use `.avr_signal`.
pub const Signal: CallingConvention = .avr_signal;
/// Deprecated; use `.x86_stdcall`.
pub const Stdcall: CallingConvention = .{ .x86_stdcall = .{} };
/// Deprecated; use `.x86_fastcall`.
pub const Fastcall: CallingConvention = .{ .x86_fastcall = .{} };
/// Deprecated; use `.x86_64_vectorcall`, `.x86_vectorcall`, or `aarch64_vfabi`.
pub const Vectorcall: CallingConvention = switch (builtin.target.cpu.arch) {
.x86_64 => .{ .x86_64_vectorcall = .{} },
.x86 => .{ .x86_vectorcall = .{} },
.aarch64, .aarch64_be => .{ .aarch64_vfabi = .{} },
else => unreachable,
};
/// Deprecated; use `.x86_thiscall`.
pub const Thiscall: CallingConvention = .{ .x86_thiscall = .{} };
/// Deprecated; use `.arm_aapcs`.
pub const AAPCS: CallingConvention = .{ .arm_aapcs = .{} };
/// Deprecated; use `.arm_aapcs_vfp`.
pub const AAPCSVFP: CallingConvention = .{ .arm_aapcs_vfp = .{} };
/// Deprecated; use `.x86_64_sysv`.
pub const SysV: CallingConvention = .{ .x86_64_sysv = .{} };
/// Deprecated; use `.x86_64_win`.
pub const Win64: CallingConvention = .{ .x86_64_win = .{} };
/// Deprecated; use `.kernel`.
pub const Kernel: CallingConvention = .kernel;
/// Deprecated; use `.spirv_fragment`.
pub const Fragment: CallingConvention = .spirv_fragment;
/// Deprecated; use `.spirv_vertex`.
pub const Vertex: CallingConvention = .spirv_vertex;
/// The default Zig calling convention when neither `export` nor `inline` is specified. /// The default Zig calling convention when neither `export` nor `inline` is specified.
/// This calling convention makes no guarantees about stack alignment, registers, etc. /// This calling convention makes no guarantees about stack alignment, registers, etc.
/// It can only be used within this Zig compilation unit. /// It can only be used within this Zig compilation unit.
@ -1117,10 +1069,6 @@ pub const TestFn = struct {
func: *const fn () anyerror!void, func: *const fn () anyerror!void,
}; };
/// Deprecated, use the `Panic` namespace instead.
/// To be deleted after 0.14.0 is released.
pub const PanicFn = fn ([]const u8, ?*StackTrace, ?usize) noreturn;
/// This namespace is used by the Zig compiler to emit various kinds of safety /// This namespace is used by the Zig compiler to emit various kinds of safety
/// panics. These can be overridden by making a public `panic` namespace in the /// panics. These can be overridden by making a public `panic` namespace in the
/// root source file. /// root source file.
@ -1136,9 +1084,6 @@ pub const panic: type = p: {
} }
break :p root.panic; break :p root.panic;
} }
if (@hasDecl(root, "Panic")) {
break :p root.Panic; // Deprecated; use `panic` instead.
}
break :p switch (builtin.zig_backend) { break :p switch (builtin.zig_backend) {
.stage2_powerpc, .stage2_powerpc,
.stage2_riscv64, .stage2_riscv64,

View File

@ -101,7 +101,6 @@ pub const dh = struct {
pub const kem = struct { pub const kem = struct {
pub const kyber_d00 = @import("crypto/ml_kem.zig").d00; pub const kyber_d00 = @import("crypto/ml_kem.zig").d00;
pub const ml_kem = @import("crypto/ml_kem.zig").nist; pub const ml_kem = @import("crypto/ml_kem.zig").nist;
pub const ml_kem_01 = @compileError("deprecated: final version of the specification has been published, use ml_kem instead");
}; };
/// Elliptic-curve arithmetic. /// Elliptic-curve arithmetic.
@ -400,20 +399,3 @@ test secureZero {
try std.testing.expectEqualSlices(u8, &a, &b); try std.testing.expectEqualSlices(u8, &a, &b);
} }
/// Deprecated in favor of `std.crypto`. To be removed after Zig 0.14.0 is released.
///
/// As a reminder, never use "utils" in a namespace (in any programming language).
/// https://ziglang.org/documentation/0.13.0/#Avoid-Redundancy-in-Names
pub const utils = struct {
/// Deprecated in favor of `std.crypto.secureZero`.
pub const secureZero = std.crypto.secureZero;
/// Deprecated in favor of `std.crypto.timing_safe.eql`.
pub const timingSafeEql = timing_safe.eql;
/// Deprecated in favor of `std.crypto.timing_safe.compare`.
pub const timingSafeCompare = timing_safe.compare;
/// Deprecated in favor of `std.crypto.timing_safe.add`.
pub const timingSafeAdd = timing_safe.add;
/// Deprecated in favor of `std.crypto.timing_safe.sub`.
pub const timingSafeSub = timing_safe.sub;
};

View File

@ -265,7 +265,7 @@ test classify {
// Comparing secret data must be done in constant time. The result // Comparing secret data must be done in constant time. The result
// is going to be considered as secret as well. // is going to be considered as secret as well.
var res = std.crypto.utils.timingSafeEql([32]u8, out, secret); var res = std.crypto.timing_safe.eql([32]u8, out, secret);
// If we want to make a conditional jump based on a secret, // If we want to make a conditional jump based on a secret,
// it has to be declassified. // it has to be declassified.

View File

@ -227,10 +227,6 @@ pub fn print(comptime fmt: []const u8, args: anytype) void {
nosuspend bw.print(fmt, args) catch return; nosuspend bw.print(fmt, args) catch return;
} }
pub fn getStderrMutex() *std.Thread.Mutex {
@compileError("deprecated. call std.debug.lockStdErr() and std.debug.unlockStdErr() instead which will integrate properly with std.Progress");
}
/// TODO multithreaded awareness /// TODO multithreaded awareness
var self_debug_info: ?SelfInfo = null; var self_debug_info: ?SelfInfo = null;

View File

@ -35,8 +35,6 @@ pub const realpathW = posix.realpathW;
pub const getAppDataDir = @import("fs/get_app_data_dir.zig").getAppDataDir; pub const getAppDataDir = @import("fs/get_app_data_dir.zig").getAppDataDir;
pub const GetAppDataDirError = @import("fs/get_app_data_dir.zig").GetAppDataDirError; pub const GetAppDataDirError = @import("fs/get_app_data_dir.zig").GetAppDataDirError;
pub const MAX_PATH_BYTES = @compileError("deprecated; renamed to max_path_bytes");
/// The maximum length of a file path that the operating system will accept. /// The maximum length of a file path that the operating system will accept.
/// ///
/// Paths, including those returned from file system operations, may be longer /// Paths, including those returned from file system operations, may be longer
@ -90,9 +88,6 @@ pub const max_name_bytes = switch (native_os) {
@compileError("NAME_MAX not implemented for " ++ @tagName(native_os)), @compileError("NAME_MAX not implemented for " ++ @tagName(native_os)),
}; };
/// Deprecated: use `max_name_bytes`
pub const MAX_NAME_BYTES = max_name_bytes;
pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*; pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*;
/// Base64 encoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. /// Base64 encoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem.
@ -101,11 +96,6 @@ pub const base64_encoder = base64.Base64Encoder.init(base64_alphabet, null);
/// Base64 decoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. /// Base64 decoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem.
pub const base64_decoder = base64.Base64Decoder.init(base64_alphabet, null); pub const base64_decoder = base64.Base64Decoder.init(base64_alphabet, null);
/// Deprecated. Use `cwd().atomicSymLink()` instead.
pub fn atomicSymLink(_: Allocator, existing_path: []const u8, new_path: []const u8) !void {
try cwd().atomicSymLink(existing_path, new_path, .{});
}
/// Same as `Dir.updateFile`, except asserts that both `source_path` and `dest_path` /// Same as `Dir.updateFile`, except asserts that both `source_path` and `dest_path`
/// are absolute. See `Dir.updateFile` for a function that operates on both /// are absolute. See `Dir.updateFile` for a function that operates on both
/// absolute and relative paths. /// absolute and relative paths.

View File

@ -1402,9 +1402,6 @@ pub fn setAsCwd(self: Dir) !void {
try posix.fchdir(self.fd); try posix.fchdir(self.fd);
} }
/// Deprecated: use `OpenOptions`
pub const OpenDirOptions = OpenOptions;
pub const OpenOptions = struct { pub const OpenOptions = struct {
/// `true` means the opened directory can be used as the `Dir` parameter /// `true` means the opened directory can be used as the `Dir` parameter
/// for functions which operate based on an open directory handle. When `false`, /// for functions which operate based on an open directory handle. When `false`,
@ -2459,8 +2456,6 @@ pub fn writeFile(self: Dir, options: WriteFileOptions) WriteFileError!void {
try file.writeAll(options.data); try file.writeAll(options.data);
} }
pub const writeFile2 = @compileError("deprecated; renamed to writeFile");
pub const AccessError = posix.AccessError; pub const AccessError = posix.AccessError;
/// Test accessing `sub_path`. /// Test accessing `sub_path`.

View File

@ -81,9 +81,8 @@ fn uint16(input: u16) u16 {
return x; return x;
} }
/// DEPRECATED: use std.hash.int()
/// Source: https://github.com/skeeto/hash-prospector /// Source: https://github.com/skeeto/hash-prospector
pub fn uint32(input: u32) u32 { fn uint32(input: u32) u32 {
var x: u32 = input; var x: u32 = input;
x = (x ^ (x >> 17)) *% 0xed5ad4bb; x = (x ^ (x >> 17)) *% 0xed5ad4bb;
x = (x ^ (x >> 11)) *% 0xac4c1b51; x = (x ^ (x >> 11)) *% 0xac4c1b51;

View File

@ -100,13 +100,3 @@ pub fn Crc(comptime W: type, comptime algorithm: Algorithm(W)) type {
} }
}; };
} }
pub const Polynomial = enum(u32) {
IEEE = @compileError("use Crc with algorithm .Crc32IsoHdlc"),
Castagnoli = @compileError("use Crc with algorithm .Crc32Iscsi"),
Koopman = @compileError("use Crc with algorithm .Crc32Koopman"),
_,
};
pub const Crc32WithPoly = @compileError("use Crc instead");
pub const Crc32SmallWithPoly = @compileError("use Crc instead");

View File

@ -33,9 +33,6 @@ pub fn readUleb128(comptime T: type, reader: anytype) !T {
return @as(T, @truncate(value)); return @as(T, @truncate(value));
} }
/// Deprecated: use `readUleb128`
pub const readULEB128 = readUleb128;
/// Write a single unsigned integer as unsigned LEB128 to the given writer. /// Write a single unsigned integer as unsigned LEB128 to the given writer.
pub fn writeUleb128(writer: anytype, arg: anytype) !void { pub fn writeUleb128(writer: anytype, arg: anytype) !void {
const Arg = @TypeOf(arg); const Arg = @TypeOf(arg);
@ -58,9 +55,6 @@ pub fn writeUleb128(writer: anytype, arg: anytype) !void {
} }
} }
/// Deprecated: use `writeUleb128`
pub const writeULEB128 = writeUleb128;
/// Read a single signed LEB128 value from the given reader as type T, /// Read a single signed LEB128 value from the given reader as type T,
/// or error.Overflow if the value cannot fit. /// or error.Overflow if the value cannot fit.
pub fn readIleb128(comptime T: type, reader: anytype) !T { pub fn readIleb128(comptime T: type, reader: anytype) !T {
@ -119,9 +113,6 @@ pub fn readIleb128(comptime T: type, reader: anytype) !T {
return @as(T, @truncate(result)); return @as(T, @truncate(result));
} }
/// Deprecated: use `readIleb128`
pub const readILEB128 = readIleb128;
/// Write a single signed integer as signed LEB128 to the given writer. /// Write a single signed integer as signed LEB128 to the given writer.
pub fn writeIleb128(writer: anytype, arg: anytype) !void { pub fn writeIleb128(writer: anytype, arg: anytype) !void {
const Arg = @TypeOf(arg); const Arg = @TypeOf(arg);
@ -176,9 +167,6 @@ pub fn writeUnsignedExtended(slice: []u8, arg: anytype) void {
slice[slice.len - 1] = @as(u7, @intCast(value)); slice[slice.len - 1] = @as(u7, @intCast(value));
} }
/// Deprecated: use `writeIleb128`
pub const writeILEB128 = writeIleb128;
test writeUnsignedFixed { test writeUnsignedFixed {
{ {
var buf: [4]u8 = undefined; var buf: [4]u8 = undefined;

View File

@ -2222,9 +2222,6 @@ pub const Const = struct {
TargetTooSmall, TargetTooSmall,
}; };
/// Deprecated; use `toInt`.
pub const to = toInt;
/// Convert `self` to `Int`. /// Convert `self` to `Int`.
/// ///
/// Returns an error if self cannot be narrowed into the requested type without truncation. /// Returns an error if self cannot be narrowed into the requested type without truncation.
@ -2855,9 +2852,6 @@ pub const Managed = struct {
pub const ConvertError = Const.ConvertError; pub const ConvertError = Const.ConvertError;
/// Deprecated; use `toInt`.
pub const to = toInt;
/// Convert `self` to `Int`. /// Convert `self` to `Int`.
/// ///
/// Returns an error if self cannot be narrowed into the requested type without truncation. /// Returns an error if self cannot be narrowed into the requested type without truncation.

View File

@ -688,7 +688,7 @@ test "string set base 36" {
defer a.deinit(); defer a.deinit();
try a.setString(36, "fifvthrv1mzt79ez9"); try a.setString(36, "fifvthrv1mzt79ez9");
try testing.expectEqual(123456789123456789123456789, try a.to(u128)); try testing.expectEqual(123456789123456789123456789, try a.toInt(u128));
} }
test "string set bad char error" { test "string set bad char error" {

View File

@ -2258,8 +2258,6 @@ test byteSwapAllFields {
}, k); }, k);
} }
pub const tokenize = @compileError("deprecated; use tokenizeAny, tokenizeSequence, or tokenizeScalar");
/// Returns an iterator that iterates over the slices of `buffer` that are not /// Returns an iterator that iterates over the slices of `buffer` that are not
/// any of the items in `delimiters`. /// any of the items in `delimiters`.
/// ///
@ -2458,8 +2456,6 @@ test "tokenize (reset)" {
} }
} }
pub const split = @compileError("deprecated; use splitSequence, splitAny, or splitScalar");
/// Returns an iterator that iterates over the slices of `buffer` that /// Returns an iterator that iterates over the slices of `buffer` that
/// are separated by the byte sequence in `delimiter`. /// are separated by the byte sequence in `delimiter`.
/// ///
@ -2659,8 +2655,6 @@ test "split (reset)" {
} }
} }
pub const splitBackwards = @compileError("deprecated; use splitBackwardsSequence, splitBackwardsAny, or splitBackwardsScalar");
/// Returns an iterator that iterates backwards over the slices of `buffer` that /// Returns an iterator that iterates backwards over the slices of `buffer` that
/// are separated by the sequence in `delimiter`. /// are separated by the sequence in `delimiter`.
/// ///

View File

@ -418,29 +418,6 @@ test fieldInfo {
try testing.expect(comptime uf.type == u8); try testing.expect(comptime uf.type == u8);
} }
/// Deprecated: use @FieldType
pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type {
return @FieldType(T, @tagName(field));
}
test FieldType {
const S = struct {
a: u8,
b: u16,
};
const U = union {
c: u32,
d: *const u8,
};
try testing.expect(FieldType(S, .a) == u8);
try testing.expect(FieldType(S, .b) == u16);
try testing.expect(FieldType(U, .c) == u32);
try testing.expect(FieldType(U, .d) == *const u8);
}
pub fn fieldNames(comptime T: type) *const [fields(T).len][:0]const u8 { pub fn fieldNames(comptime T: type) *const [fields(T).len][:0]const u8 {
return comptime blk: { return comptime blk: {
const fieldInfos = fields(T); const fieldInfos = fields(T);

View File

@ -214,8 +214,6 @@ pub const Address = extern union {
/// Sets SO_REUSEADDR and SO_REUSEPORT on POSIX. /// Sets SO_REUSEADDR and SO_REUSEPORT on POSIX.
/// Sets SO_REUSEADDR on Windows, which is roughly equivalent. /// Sets SO_REUSEADDR on Windows, which is roughly equivalent.
reuse_address: bool = false, reuse_address: bool = false,
/// Deprecated. Does the same thing as reuse_address.
reuse_port: bool = false,
force_nonblocking: bool = false, force_nonblocking: bool = false,
}; };
@ -232,7 +230,7 @@ pub const Address = extern union {
}; };
errdefer s.stream.close(); errdefer s.stream.close();
if (options.reuse_address or options.reuse_port) { if (options.reuse_address) {
try posix.setsockopt( try posix.setsockopt(
sockfd, sockfd,
posix.SOL.SOCKET, posix.SOL.SOCKET,

View File

@ -232,10 +232,10 @@ test "listen on an in use port" {
const localhost = try net.Address.parseIp("127.0.0.1", 0); const localhost = try net.Address.parseIp("127.0.0.1", 0);
var server1 = try localhost.listen(.{ .reuse_port = true }); var server1 = try localhost.listen(.{ .reuse_address = true });
defer server1.deinit(); defer server1.deinit();
var server2 = try server1.listen_address.listen(.{ .reuse_port = true }); var server2 = try server1.listen_address.listen(.{ .reuse_address = true });
defer server2.deinit(); defer server2.deinit();
} }
@ -315,7 +315,7 @@ test "listen on a unix socket, send bytes, receive bytes" {
try testing.expectEqualSlices(u8, "Hello world!", buf[0..n]); try testing.expectEqualSlices(u8, "Hello world!", buf[0..n]);
} }
test "listen on a unix socket with reuse_port option" { test "listen on a unix socket with reuse_address option" {
if (!net.has_unix_sockets) return error.SkipZigTest; if (!net.has_unix_sockets) return error.SkipZigTest;
// Windows doesn't implement reuse port option. // Windows doesn't implement reuse port option.
if (builtin.os.tag == .windows) return error.SkipZigTest; if (builtin.os.tag == .windows) return error.SkipZigTest;
@ -326,7 +326,7 @@ test "listen on a unix socket with reuse_port option" {
const socket_addr = try net.Address.initUnix(socket_path); const socket_addr = try net.Address.initUnix(socket_path);
defer std.fs.cwd().deleteFile(socket_path) catch {}; defer std.fs.cwd().deleteFile(socket_path) catch {};
var server = try socket_addr.listen(.{ .reuse_port = true }); var server = try socket_addr.listen(.{ .reuse_address = true });
server.deinit(); server.deinit();
} }

View File

@ -146,7 +146,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN
// call has failed. There is not really a sane way to handle // call has failed. There is not really a sane way to handle
// this other than retrying the creation after the OS finishes // this other than retrying the creation after the OS finishes
// the deletion. // the deletion.
std.time.sleep(std.time.ns_per_ms); std.Thread.sleep(std.time.ns_per_ms);
continue; continue;
}, },
.VIRUS_INFECTED, .VIRUS_DELETED => return error.AntivirusInterference, .VIRUS_INFECTED, .VIRUS_DELETED => return error.AntivirusInterference,
@ -2848,9 +2848,6 @@ pub const STD_OUTPUT_HANDLE = maxInt(DWORD) - 11 + 1;
/// The standard error device. Initially, this is the active console screen buffer, CONOUT$. /// The standard error device. Initially, this is the active console screen buffer, CONOUT$.
pub const STD_ERROR_HANDLE = maxInt(DWORD) - 12 + 1; pub const STD_ERROR_HANDLE = maxInt(DWORD) - 12 + 1;
/// Deprecated; use `std.builtin.CallingConvention.winapi` instead.
pub const WINAPI: std.builtin.CallingConvention = .winapi;
pub const BOOL = c_int; pub const BOOL = c_int;
pub const BOOLEAN = BYTE; pub const BOOLEAN = BYTE;
pub const BYTE = u8; pub const BYTE = u8;

View File

@ -1161,7 +1161,7 @@ test "POSIX file locking with fcntl" {
posix.exit(0); posix.exit(0);
} else { } else {
// parent waits for child to get shared lock: // parent waits for child to get shared lock:
std.time.sleep(1 * std.time.ns_per_ms); std.Thread.sleep(1 * std.time.ns_per_ms);
// parent expects deadlock when attempting to upgrade the shared lock to exclusive: // parent expects deadlock when attempting to upgrade the shared lock to exclusive:
struct_flock.start = 1; struct_flock.start = 1;
struct_flock.type = posix.F.WRLCK; struct_flock.type = posix.F.WRLCK;

View File

@ -8,9 +8,6 @@ const posix = std.posix;
pub const epoch = @import("time/epoch.zig"); pub const epoch = @import("time/epoch.zig");
/// Deprecated: moved to std.Thread.sleep
pub const sleep = std.Thread.sleep;
/// Get a calendar timestamp, in seconds, relative to UTC 1970-01-01. /// Get a calendar timestamp, in seconds, relative to UTC 1970-01-01.
/// Precision of timing depends on the hardware and operating system. /// Precision of timing depends on the hardware and operating system.
/// The return value is signed because it is possible to have a date that is /// The return value is signed because it is possible to have a date that is

View File

@ -972,8 +972,6 @@ pub fn utf16LeToUtf8ArrayList(result: *std.ArrayList(u8), utf16le: []const u16)
return utf16LeToUtf8ArrayListImpl(result, utf16le, .cannot_encode_surrogate_half); return utf16LeToUtf8ArrayListImpl(result, utf16le, .cannot_encode_surrogate_half);
} }
pub const utf16leToUtf8Alloc = @compileError("deprecated; renamed to utf16LeToUtf8Alloc");
/// Caller must free returned memory. /// Caller must free returned memory.
pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![]u8 { pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![]u8 {
// optimistically guess that it will all be ascii. // optimistically guess that it will all be ascii.
@ -984,8 +982,6 @@ pub fn utf16LeToUtf8Alloc(allocator: mem.Allocator, utf16le: []const u16) Utf16L
return result.toOwnedSlice(); return result.toOwnedSlice();
} }
pub const utf16leToUtf8AllocZ = @compileError("deprecated; renamed to utf16LeToUtf8AllocZ");
/// Caller must free returned memory. /// Caller must free returned memory.
pub fn utf16LeToUtf8AllocZ(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![:0]u8 { pub fn utf16LeToUtf8AllocZ(allocator: mem.Allocator, utf16le: []const u16) Utf16LeToUtf8AllocError![:0]u8 {
// optimistically guess that it will all be ascii (and allocate space for the null terminator) // optimistically guess that it will all be ascii (and allocate space for the null terminator)
@ -1054,8 +1050,6 @@ fn utf16LeToUtf8Impl(utf8: []u8, utf16le: []const u16, comptime surrogates: Surr
return dest_index; return dest_index;
} }
pub const utf16leToUtf8 = @compileError("deprecated; renamed to utf16LeToUtf8");
pub fn utf16LeToUtf8(utf8: []u8, utf16le: []const u16) Utf16LeToUtf8Error!usize { pub fn utf16LeToUtf8(utf8: []u8, utf16le: []const u16) Utf16LeToUtf8Error!usize {
return utf16LeToUtf8Impl(utf8, utf16le, .cannot_encode_surrogate_half); return utf16LeToUtf8Impl(utf8, utf16le, .cannot_encode_surrogate_half);
} }
@ -1175,8 +1169,6 @@ pub fn utf8ToUtf16LeAlloc(allocator: mem.Allocator, utf8: []const u8) error{ Inv
return result.toOwnedSlice(); return result.toOwnedSlice();
} }
pub const utf8ToUtf16LeWithNull = @compileError("deprecated; renamed to utf8ToUtf16LeAllocZ");
pub fn utf8ToUtf16LeAllocZ(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![:0]u16 { pub fn utf8ToUtf16LeAllocZ(allocator: mem.Allocator, utf8: []const u8) error{ InvalidUtf8, OutOfMemory }![:0]u16 {
// optimistically guess that it will not require surrogate pairs // optimistically guess that it will not require surrogate pairs
var result = try std.ArrayList(u16).initCapacity(allocator, utf8.len + 1); var result = try std.ArrayList(u16).initCapacity(allocator, utf8.len + 1);
@ -1487,8 +1479,6 @@ fn formatUtf16Le(utf16le: []const u16, writer: *std.io.Writer) std.io.Writer.Err
try writer.writeAll(buf[0..u8len]); try writer.writeAll(buf[0..u8len]);
} }
pub const fmtUtf16le = @compileError("deprecated; renamed to fmtUtf16Le");
/// Return a Formatter for a (potentially ill-formed) UTF-16 LE string, /// Return a Formatter for a (potentially ill-formed) UTF-16 LE string,
/// which will be converted to UTF-8 during formatting. /// which will be converted to UTF-8 during formatting.
/// Unpaired surrogates are replaced by the replacement character (U+FFFD). /// Unpaired surrogates are replaced by the replacement character (U+FFFD).

View File

@ -200,18 +200,6 @@ pub fn nonSimdCall3(func: fn (usize, usize, usize, usize) usize, a1: usize, a2:
return doClientRequestExpr(0, .ClientCall3, @intFromPtr(func), a1, a2, a3, 0); return doClientRequestExpr(0, .ClientCall3, @intFromPtr(func), a1, a2, a3, 0);
} }
/// Deprecated: use `nonSimdCall0`
pub const nonSIMDCall0 = nonSimdCall0;
/// Deprecated: use `nonSimdCall1`
pub const nonSIMDCall1 = nonSimdCall1;
/// Deprecated: use `nonSimdCall2`
pub const nonSIMDCall2 = nonSimdCall2;
/// Deprecated: use `nonSimdCall3`
pub const nonSIMDCall3 = nonSimdCall3;
/// Counts the number of errors that have been recorded by a tool. Nb: /// Counts the number of errors that have been recorded by a tool. Nb:
/// the tool must record the errors with VG_(maybe_record_error)() or /// the tool must record the errors with VG_(maybe_record_error)() or
/// VG_(unique_error)() for them to be counted. /// VG_(unique_error)() for them to be counted.

View File

@ -10,8 +10,6 @@ pub const ClientRequest = enum(usize) {
StopInstrumentation, StopInstrumentation,
}; };
pub const CallgrindClientRequest = @compileError("std.valgrind.callgrind.CallgrindClientRequest renamed to std.valgrind.callgrind.ClientRequest");
fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize {
return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5); return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5);
} }

View File

@ -20,8 +20,6 @@ pub const ClientRequest = enum(usize) {
DisableAddrErrorReportingInRange, DisableAddrErrorReportingInRange,
}; };
pub const MemCheckClientRequest = @compileError("std.valgrind.memcheck.MemCheckClientRequest renamed to std.valgrind.memcheck.ClientRequest");
fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize {
return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5); return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5);
} }

View File

@ -17,7 +17,6 @@ pub const Zir = @import("zig/Zir.zig");
pub const Zoir = @import("zig/Zoir.zig"); pub const Zoir = @import("zig/Zoir.zig");
pub const ZonGen = @import("zig/ZonGen.zig"); pub const ZonGen = @import("zig/ZonGen.zig");
pub const system = @import("zig/system.zig"); pub const system = @import("zig/system.zig");
pub const CrossTarget = @compileError("deprecated; use std.Target.Query");
pub const BuiltinFn = @import("zig/BuiltinFn.zig"); pub const BuiltinFn = @import("zig/BuiltinFn.zig");
pub const AstRlAnnotate = @import("zig/AstRlAnnotate.zig"); pub const AstRlAnnotate = @import("zig/AstRlAnnotate.zig");
pub const LibCInstallation = @import("zig/LibCInstallation.zig"); pub const LibCInstallation = @import("zig/LibCInstallation.zig");
@ -604,7 +603,7 @@ pub fn putAstErrorsIntoBundle(
pub fn resolveTargetQueryOrFatal(target_query: std.Target.Query) std.Target { pub fn resolveTargetQueryOrFatal(target_query: std.Target.Query) std.Target {
return std.zig.system.resolveTargetQuery(target_query) catch |err| return std.zig.system.resolveTargetQuery(target_query) catch |err|
fatal("unable to resolve target: {s}", .{@errorName(err)}); std.process.fatal("unable to resolve target: {s}", .{@errorName(err)});
} }
pub fn parseTargetQueryOrReportFatalError( pub fn parseTargetQueryOrReportFatalError(
@ -628,7 +627,7 @@ pub fn parseTargetQueryOrReportFatalError(
@tagName(diags.arch.?), help_text.items, @tagName(diags.arch.?), help_text.items,
}); });
} }
fatal("unknown CPU: '{s}'", .{diags.cpu_name.?}); std.process.fatal("unknown CPU: '{s}'", .{diags.cpu_name.?});
}, },
error.UnknownCpuFeature => { error.UnknownCpuFeature => {
help: { help: {
@ -641,7 +640,7 @@ pub fn parseTargetQueryOrReportFatalError(
@tagName(diags.arch.?), help_text.items, @tagName(diags.arch.?), help_text.items,
}); });
} }
fatal("unknown CPU feature: '{s}'", .{diags.unknown_feature_name.?}); std.process.fatal("unknown CPU feature: '{s}'", .{diags.unknown_feature_name.?});
}, },
error.UnknownObjectFormat => { error.UnknownObjectFormat => {
help: { help: {
@ -652,7 +651,7 @@ pub fn parseTargetQueryOrReportFatalError(
} }
std.log.info("available object formats:\n{s}", .{help_text.items}); std.log.info("available object formats:\n{s}", .{help_text.items});
} }
fatal("unknown object format: '{s}'", .{opts.object_format.?}); std.process.fatal("unknown object format: '{s}'", .{opts.object_format.?});
}, },
error.UnknownArchitecture => { error.UnknownArchitecture => {
help: { help: {
@ -663,17 +662,14 @@ pub fn parseTargetQueryOrReportFatalError(
} }
std.log.info("available architectures:\n{s} native\n", .{help_text.items}); std.log.info("available architectures:\n{s} native\n", .{help_text.items});
} }
fatal("unknown architecture: '{s}'", .{diags.unknown_architecture_name.?}); std.process.fatal("unknown architecture: '{s}'", .{diags.unknown_architecture_name.?});
}, },
else => |e| fatal("unable to parse target query '{s}': {s}", .{ else => |e| std.process.fatal("unable to parse target query '{s}': {s}", .{
opts.arch_os_abi, @errorName(e), opts.arch_os_abi, @errorName(e),
}), }),
}; };
} }
/// Deprecated; see `std.process.fatal`.
pub const fatal = std.process.fatal;
/// Collects all the environment variables that Zig could possibly inspect, so /// Collects all the environment variables that Zig could possibly inspect, so
/// that we can do reflection on this and print them with `zig env`. /// that we can do reflection on this and print them with `zig env`.
pub const EnvVar = enum { pub const EnvVar = enum {

View File

@ -254,9 +254,6 @@ test "sizeof" {
pub const CIntLiteralBase = enum { decimal, octal, hex }; pub const CIntLiteralBase = enum { decimal, octal, hex };
/// Deprecated: use `CIntLiteralBase`
pub const CIntLiteralRadix = CIntLiteralBase;
fn PromoteIntLiteralReturnType(comptime SuffixType: type, comptime number: comptime_int, comptime base: CIntLiteralBase) type { fn PromoteIntLiteralReturnType(comptime SuffixType: type, comptime number: comptime_int, comptime base: CIntLiteralBase) type {
const signed_decimal = [_]type{ c_int, c_long, c_longlong, c_ulonglong }; const signed_decimal = [_]type{ c_int, c_long, c_longlong, c_ulonglong };
const signed_oct_hex = [_]type{ c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong }; const signed_oct_hex = [_]type{ c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong };

View File

@ -10638,7 +10638,7 @@ fn fnTypeAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = std.hash.Wyhash.init(comptime std.hash.uint32(@intFromEnum(tag))); var hasher = std.hash.Wyhash.init(comptime std.hash.int(@intFromEnum(tag)));
hasher.update(std.mem.asBytes(&key.ret)); hasher.update(std.mem.asBytes(&key.ret));
hasher.update(std.mem.sliceAsBytes(key.params)); hasher.update(std.mem.sliceAsBytes(key.params));
return @truncate(hasher.final()); return @truncate(hasher.final());
@ -10698,7 +10698,7 @@ fn vectorTypeAssumeCapacity(
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Type.Vector) u32 { pub fn hash(_: @This(), key: Type.Vector) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(tag)), comptime std.hash.int(@intFromEnum(tag)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -10727,7 +10727,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Type.Vector) u32 { pub fn hash(_: @This(), key: Type.Vector) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Type.Tag.small_array)), comptime std.hash.int(@intFromEnum(Type.Tag.small_array)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -10753,7 +10753,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Type.Array) u32 { pub fn hash(_: @This(), key: Type.Array) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Type.Tag.array)), comptime std.hash.int(@intFromEnum(Type.Tag.array)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -10794,7 +10794,7 @@ fn structTypeAssumeCapacity(
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: []const Type) u32 { pub fn hash(_: @This(), key: []const Type) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(tag)), comptime std.hash.int(@intFromEnum(tag)),
std.mem.sliceAsBytes(key), std.mem.sliceAsBytes(key),
)); ));
} }
@ -10826,7 +10826,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: String) u32 { pub fn hash(_: @This(), key: String) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Type.Tag.named_structure)), comptime std.hash.int(@intFromEnum(Type.Tag.named_structure)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -10887,7 +10887,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Type.Item) u32 { pub fn hash(_: @This(), key: Type.Item) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Type.Tag.simple)), comptime std.hash.int(@intFromEnum(Type.Tag.simple)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -11021,7 +11021,7 @@ fn bigIntConstAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(key.tag))); var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag)));
hasher.update(std.mem.asBytes(&key.type)); hasher.update(std.mem.asBytes(&key.type));
hasher.update(std.mem.sliceAsBytes(key.limbs)); hasher.update(std.mem.sliceAsBytes(key.limbs));
return @truncate(hasher.final()); return @truncate(hasher.final());
@ -11084,7 +11084,7 @@ fn doubleConstAssumeCapacity(self: *Builder, val: f64) Constant {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: f64) u32 { pub fn hash(_: @This(), key: f64) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Constant.Tag.double)), comptime std.hash.int(@intFromEnum(Constant.Tag.double)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -11115,7 +11115,7 @@ fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: f128) u32 { pub fn hash(_: @This(), key: f128) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Constant.Tag.fp128)), comptime std.hash.int(@intFromEnum(Constant.Tag.fp128)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -11149,7 +11149,7 @@ fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: f80) u32 { pub fn hash(_: @This(), key: f80) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Constant.Tag.x86_fp80)), comptime std.hash.int(@intFromEnum(Constant.Tag.x86_fp80)),
std.mem.asBytes(&key)[0..10], std.mem.asBytes(&key)[0..10],
)); ));
} }
@ -11182,7 +11182,7 @@ fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: [2]f64) u32 { pub fn hash(_: @This(), key: [2]f64) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Constant.Tag.ppc_fp128)), comptime std.hash.int(@intFromEnum(Constant.Tag.ppc_fp128)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -11317,7 +11317,7 @@ fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Constant.Splat) u32 { pub fn hash(_: @This(), key: Constant.Splat) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Constant.Tag.splat)), comptime std.hash.int(@intFromEnum(Constant.Tag.splat)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -11420,7 +11420,7 @@ fn blockAddrConstAssumeCapacity(
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Constant.BlockAddress) u32 { pub fn hash(_: @This(), key: Constant.BlockAddress) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
comptime std.hash.uint32(@intFromEnum(Constant.Tag.blockaddress)), comptime std.hash.int(@intFromEnum(Constant.Tag.blockaddress)),
std.mem.asBytes(&key), std.mem.asBytes(&key),
)); ));
} }
@ -11546,7 +11546,7 @@ fn castConstAssumeCapacity(self: *Builder, tag: Constant.Tag, val: Constant, ty:
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
std.hash.uint32(@intFromEnum(key.tag)), std.hash.int(@intFromEnum(key.tag)),
std.mem.asBytes(&key.cast), std.mem.asBytes(&key.cast),
)); ));
} }
@ -11621,7 +11621,7 @@ fn gepConstAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = std.hash.Wyhash.init(comptime std.hash.uint32(@intFromEnum(tag))); var hasher = std.hash.Wyhash.init(comptime std.hash.int(@intFromEnum(tag)));
hasher.update(std.mem.asBytes(&key.type)); hasher.update(std.mem.asBytes(&key.type));
hasher.update(std.mem.asBytes(&key.base)); hasher.update(std.mem.asBytes(&key.base));
hasher.update(std.mem.asBytes(&key.inrange)); hasher.update(std.mem.asBytes(&key.inrange));
@ -11685,7 +11685,7 @@ fn binConstAssumeCapacity(
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
std.hash.uint32(@intFromEnum(key.tag)), std.hash.int(@intFromEnum(key.tag)),
std.mem.asBytes(&key.extra), std.mem.asBytes(&key.extra),
)); ));
} }
@ -11723,7 +11723,7 @@ fn asmConstAssumeCapacity(
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
std.hash.uint32(@intFromEnum(key.tag)), std.hash.int(@intFromEnum(key.tag)),
std.mem.asBytes(&key.extra), std.mem.asBytes(&key.extra),
)); ));
} }
@ -11773,7 +11773,7 @@ fn getOrPutConstantNoExtraAssumeCapacity(
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Constant.Item) u32 { pub fn hash(_: @This(), key: Constant.Item) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
std.hash.uint32(@intFromEnum(key.tag)), std.hash.int(@intFromEnum(key.tag)),
std.mem.asBytes(&key.data), std.mem.asBytes(&key.data),
)); ));
} }
@ -11804,7 +11804,7 @@ fn getOrPutConstantAggregateAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(key.tag))); var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag)));
hasher.update(std.mem.asBytes(&key.type)); hasher.update(std.mem.asBytes(&key.type));
hasher.update(std.mem.sliceAsBytes(key.vals)); hasher.update(std.mem.sliceAsBytes(key.vals));
return @truncate(hasher.final()); return @truncate(hasher.final());
@ -12421,7 +12421,7 @@ fn metadataSimpleAssumeCapacity(self: *Builder, tag: Metadata.Tag, value: anytyp
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(key.tag))); var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag)));
inline for (std.meta.fields(@TypeOf(value))) |field| { inline for (std.meta.fields(@TypeOf(value))) |field| {
hasher.update(std.mem.asBytes(&@field(key.value, field.name))); hasher.update(std.mem.asBytes(&@field(key.value, field.name)));
} }
@ -12457,7 +12457,7 @@ fn metadataDistinctAssumeCapacity(self: *Builder, tag: Metadata.Tag, value: anyt
const Adapter = struct { const Adapter = struct {
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
return @truncate(std.hash.Wyhash.hash( return @truncate(std.hash.Wyhash.hash(
std.hash.uint32(@intFromEnum(key.tag)), std.hash.int(@intFromEnum(key.tag)),
std.mem.asBytes(&key.index), std.mem.asBytes(&key.index),
)); ));
} }
@ -12853,7 +12853,7 @@ fn debugEnumeratorAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(key.tag))); var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag)));
hasher.update(std.mem.asBytes(&key.name)); hasher.update(std.mem.asBytes(&key.name));
hasher.update(std.mem.asBytes(&key.bit_width)); hasher.update(std.mem.asBytes(&key.bit_width));
hasher.update(std.mem.sliceAsBytes(key.value.limbs)); hasher.update(std.mem.sliceAsBytes(key.value.limbs));
@ -12935,7 +12935,7 @@ fn debugExpressionAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = comptime std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(Metadata.Tag.expression))); var hasher = comptime std.hash.Wyhash.init(std.hash.int(@intFromEnum(Metadata.Tag.expression)));
hasher.update(std.mem.sliceAsBytes(key.elements)); hasher.update(std.mem.sliceAsBytes(key.elements));
return @truncate(hasher.final()); return @truncate(hasher.final());
} }
@ -12981,7 +12981,7 @@ fn metadataTupleAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = comptime std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(Metadata.Tag.tuple))); var hasher = comptime std.hash.Wyhash.init(std.hash.int(@intFromEnum(Metadata.Tag.tuple)));
hasher.update(std.mem.sliceAsBytes(key.elements)); hasher.update(std.mem.sliceAsBytes(key.elements));
return @truncate(hasher.final()); return @truncate(hasher.final());
} }
@ -13029,7 +13029,7 @@ fn strTupleAssumeCapacity(
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Key) u32 { pub fn hash(_: @This(), key: Key) u32 {
var hasher = comptime std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(Metadata.Tag.tuple))); var hasher = comptime std.hash.Wyhash.init(std.hash.int(@intFromEnum(Metadata.Tag.tuple)));
hasher.update(std.mem.sliceAsBytes(key.elements)); hasher.update(std.mem.sliceAsBytes(key.elements));
return @truncate(hasher.final()); return @truncate(hasher.final());
} }
@ -13159,7 +13159,7 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata {
const Adapter = struct { const Adapter = struct {
builder: *const Builder, builder: *const Builder,
pub fn hash(_: @This(), key: Constant) u32 { pub fn hash(_: @This(), key: Constant) u32 {
var hasher = comptime std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(Metadata.Tag.constant))); var hasher = comptime std.hash.Wyhash.init(std.hash.int(@intFromEnum(Metadata.Tag.constant)));
hasher.update(std.mem.asBytes(&key)); hasher.update(std.mem.asBytes(&key));
return @truncate(hasher.final()); return @truncate(hasher.final());
} }

View File

@ -1861,7 +1861,7 @@ pub const NullTerminatedString = enum(u32) {
pub fn hash(ctx: @This(), a: NullTerminatedString) u32 { pub fn hash(ctx: @This(), a: NullTerminatedString) u32 {
_ = ctx; _ = ctx;
return std.hash.uint32(@intFromEnum(a)); return std.hash.int(@intFromEnum(a));
} }
}; };
@ -4740,7 +4740,7 @@ pub const Index = enum(u32) {
pub fn hash(ctx: @This(), a: Index) u32 { pub fn hash(ctx: @This(), a: Index) u32 {
_ = ctx; _ = ctx;
return std.hash.uint32(@intFromEnum(a)); return std.hash.int(@intFromEnum(a));
} }
}; };
@ -12725,7 +12725,7 @@ const GlobalErrorSet = struct {
name: NullTerminatedString, name: NullTerminatedString,
) Allocator.Error!GlobalErrorSet.Index { ) Allocator.Error!GlobalErrorSet.Index {
if (name == .empty) return .none; if (name == .empty) return .none;
const hash = std.hash.uint32(@intFromEnum(name)); const hash = std.hash.int(@intFromEnum(name));
var map = ges.shared.map.acquire(); var map = ges.shared.map.acquire();
const Map = @TypeOf(map); const Map = @TypeOf(map);
var map_mask = map.header().mask(); var map_mask = map.header().mask();
@ -12818,7 +12818,7 @@ const GlobalErrorSet = struct {
name: NullTerminatedString, name: NullTerminatedString,
) ?GlobalErrorSet.Index { ) ?GlobalErrorSet.Index {
if (name == .empty) return .none; if (name == .empty) return .none;
const hash = std.hash.uint32(@intFromEnum(name)); const hash = std.hash.int(@intFromEnum(name));
const map = ges.shared.map.acquire(); const map = ges.shared.map.acquire();
const map_mask = map.header().mask(); const map_mask = map.header().mask();
const names_items = ges.shared.names.acquire().view().items(.@"0"); const names_items = ges.shared.names.acquire().view().items(.@"0");

View File

@ -808,7 +808,7 @@ pub const Namespace = struct {
pub fn hash(ctx: NavNameContext, nav: InternPool.Nav.Index) u32 { pub fn hash(ctx: NavNameContext, nav: InternPool.Nav.Index) u32 {
const name = ctx.zcu.intern_pool.getNav(nav).name; const name = ctx.zcu.intern_pool.getNav(nav).name;
return std.hash.uint32(@intFromEnum(name)); return std.hash.int(@intFromEnum(name));
} }
pub fn eql(ctx: NavNameContext, a_nav: InternPool.Nav.Index, b_nav: InternPool.Nav.Index, b_index: usize) bool { pub fn eql(ctx: NavNameContext, a_nav: InternPool.Nav.Index, b_nav: InternPool.Nav.Index, b_index: usize) bool {
@ -824,7 +824,7 @@ pub const Namespace = struct {
pub fn hash(ctx: NameAdapter, s: InternPool.NullTerminatedString) u32 { pub fn hash(ctx: NameAdapter, s: InternPool.NullTerminatedString) u32 {
_ = ctx; _ = ctx;
return std.hash.uint32(@intFromEnum(s)); return std.hash.int(@intFromEnum(s));
} }
pub fn eql(ctx: NameAdapter, a: InternPool.NullTerminatedString, b_nav: InternPool.Nav.Index, b_index: usize) bool { pub fn eql(ctx: NameAdapter, a: InternPool.NullTerminatedString, b_nav: InternPool.Nav.Index, b_index: usize) bool {

View File

@ -3974,7 +3974,7 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index, is_dispatch_loop: bool) Inner
var width_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined }; var width_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined };
width_bigint.sub(max_bigint, min_bigint); width_bigint.sub(max_bigint, min_bigint);
width_bigint.addScalar(width_bigint.toConst(), 1); width_bigint.addScalar(width_bigint.toConst(), 1);
break :width width_bigint.toConst().to(u32) catch null; break :width width_bigint.toConst().toInt(u32) catch null;
}; };
try cg.startBlock(.block, .empty); // whole switch block start try cg.startBlock(.block, .empty); // whole switch block start
@ -4015,7 +4015,7 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index, is_dispatch_loop: bool) Inner
const val_bigint = val.toBigInt(&val_space, zcu); const val_bigint = val.toBigInt(&val_space, zcu);
var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined }; var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined };
index_bigint.sub(val_bigint, min_bigint); index_bigint.sub(val_bigint, min_bigint);
branch_list[index_bigint.toConst().to(u32) catch unreachable] = case.idx; branch_list[index_bigint.toConst().toInt(u32) catch unreachable] = case.idx;
} }
for (case.ranges) |range| { for (case.ranges) |range| {
var low_space: Value.BigIntSpace = undefined; var low_space: Value.BigIntSpace = undefined;
@ -4024,9 +4024,9 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index, is_dispatch_loop: bool) Inner
const high_bigint = Value.fromInterned(range[1].toInterned().?).toBigInt(&high_space, zcu); const high_bigint = Value.fromInterned(range[1].toInterned().?).toBigInt(&high_space, zcu);
var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined }; var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined };
index_bigint.sub(low_bigint, min_bigint); index_bigint.sub(low_bigint, min_bigint);
const start = index_bigint.toConst().to(u32) catch unreachable; const start = index_bigint.toConst().toInt(u32) catch unreachable;
index_bigint.sub(high_bigint, min_bigint); index_bigint.sub(high_bigint, min_bigint);
const end = (index_bigint.toConst().to(u32) catch unreachable) + 1; const end = (index_bigint.toConst().toInt(u32) catch unreachable) + 1;
@memset(branch_list[start..end], case.idx); @memset(branch_list[start..end], case.idx);
} }
} }

View File

@ -263,7 +263,7 @@ pub fn lowerToCode(emit: *Emit) Error!void {
code.appendNTimesAssumeCapacity(0, 5); code.appendNTimesAssumeCapacity(0, 5);
} else { } else {
const sp_global: Wasm.GlobalIndex = .stack_pointer; const sp_global: Wasm.GlobalIndex = .stack_pointer;
std.leb.writeULEB128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable; std.leb.writeUleb128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable;
} }
inst += 1; inst += 1;

View File

@ -687,7 +687,7 @@ pub fn lower(mir: *const Mir, wasm: *Wasm, code: *std.ArrayListUnmanaged(u8)) st
const sp_global: Wasm.GlobalIndex = .stack_pointer; const sp_global: Wasm.GlobalIndex = .stack_pointer;
// load stack pointer // load stack pointer
code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_get)); code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_get));
std.leb.writeULEB128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable; std.leb.writeUleb128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable;
// store stack pointer so we can restore it when we return from the function // store stack pointer so we can restore it when we return from the function
code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_tee)); code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_tee));
leb.writeUleb128(code.fixedWriter(), mir.prologue.sp_local) catch unreachable; leb.writeUleb128(code.fixedWriter(), mir.prologue.sp_local) catch unreachable;
@ -710,7 +710,7 @@ pub fn lower(mir: *const Mir, wasm: *Wasm, code: *std.ArrayListUnmanaged(u8)) st
// Store the current stack pointer value into the global stack pointer so other function calls will // Store the current stack pointer value into the global stack pointer so other function calls will
// start from this value instead and not overwrite the current stack. // start from this value instead and not overwrite the current stack.
code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set)); code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set));
std.leb.writeULEB128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable; std.leb.writeUleb128(code.fixedWriter(), @intFromEnum(sp_global)) catch unreachable;
} }
var emit: Emit = .{ var emit: Emit = .{

View File

@ -179277,7 +179277,7 @@ fn lowerSwitchBr(
var table_len_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined }; var table_len_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined };
table_len_bigint.sub(max_bigint, min_bigint); table_len_bigint.sub(max_bigint, min_bigint);
assert(table_len_bigint.positive); // min <= max assert(table_len_bigint.positive); // min <= max
break :table_len @as(u11, table_len_bigint.toConst().to(u10) catch break :table) + 1; // no more than a 1024 entry table break :table_len @as(u11, table_len_bigint.toConst().toInt(u10) catch break :table) + 1; // no more than a 1024 entry table
}; };
assert(prong_items <= table_len); // each prong item introduces at least one unique integer to the range assert(prong_items <= table_len); // each prong item introduces at least one unique integer to the range
if (prong_items < table_len >> 2) break :table; // no more than 75% waste if (prong_items < table_len >> 2) break :table; // no more than 75% waste
@ -179353,7 +179353,7 @@ fn lowerSwitchBr(
const val_bigint = val.toBigInt(&val_space, zcu); const val_bigint = val.toBigInt(&val_space, zcu);
var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined }; var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined };
index_bigint.sub(val_bigint, min_bigint); index_bigint.sub(val_bigint, min_bigint);
table[index_bigint.toConst().to(u10) catch unreachable] = @intCast(cg.mir_instructions.len); table[index_bigint.toConst().toInt(u10) catch unreachable] = @intCast(cg.mir_instructions.len);
} }
for (case.ranges) |range| { for (case.ranges) |range| {
var low_space: Value.BigIntSpace = undefined; var low_space: Value.BigIntSpace = undefined;
@ -179362,9 +179362,9 @@ fn lowerSwitchBr(
const high_bigint = Value.fromInterned(range[1].toInterned().?).toBigInt(&high_space, zcu); const high_bigint = Value.fromInterned(range[1].toInterned().?).toBigInt(&high_space, zcu);
var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined }; var index_bigint: std.math.big.int.Mutable = .{ .limbs = limbs, .positive = undefined, .len = undefined };
index_bigint.sub(low_bigint, min_bigint); index_bigint.sub(low_bigint, min_bigint);
const start = index_bigint.toConst().to(u10) catch unreachable; const start = index_bigint.toConst().toInt(u10) catch unreachable;
index_bigint.sub(high_bigint, min_bigint); index_bigint.sub(high_bigint, min_bigint);
const end = @as(u11, index_bigint.toConst().to(u10) catch unreachable) + 1; const end = @as(u11, index_bigint.toConst().toInt(u10) catch unreachable) + 1;
@memset(table[start..end], @intCast(cg.mir_instructions.len)); @memset(table[start..end], @intCast(cg.mir_instructions.len));
} }
} }

View File

@ -189,9 +189,9 @@ fn finalizeNode(self: *Trie, node_index: Node.Index, offset_in_trie: u32) !Final
if (slice.items(.is_terminal)[node_index]) { if (slice.items(.is_terminal)[node_index]) {
const export_flags = slice.items(.export_flags)[node_index]; const export_flags = slice.items(.export_flags)[node_index];
const vmaddr_offset = slice.items(.vmaddr_offset)[node_index]; const vmaddr_offset = slice.items(.vmaddr_offset)[node_index];
try leb.writeULEB128(writer, export_flags); try leb.writeUleb128(writer, export_flags);
try leb.writeULEB128(writer, vmaddr_offset); try leb.writeUleb128(writer, vmaddr_offset);
try leb.writeULEB128(writer, stream.bytes_written); try leb.writeUleb128(writer, stream.bytes_written);
} else { } else {
node_size += 1; // 0x0 for non-terminal nodes node_size += 1; // 0x0 for non-terminal nodes
} }
@ -201,7 +201,7 @@ fn finalizeNode(self: *Trie, node_index: Node.Index, offset_in_trie: u32) !Final
const edge = &self.edges.items[edge_index]; const edge = &self.edges.items[edge_index];
const next_node_offset = slice.items(.trie_offset)[edge.node]; const next_node_offset = slice.items(.trie_offset)[edge.node];
node_size += @intCast(edge.label.len + 1); node_size += @intCast(edge.label.len + 1);
try leb.writeULEB128(writer, next_node_offset); try leb.writeUleb128(writer, next_node_offset);
} }
const trie_offset = slice.items(.trie_offset)[node_index]; const trie_offset = slice.items(.trie_offset)[node_index];
@ -251,13 +251,13 @@ fn writeNode(self: *Trie, node_index: Node.Index, writer: anytype) !void {
// TODO Implement for special flags. // TODO Implement for special flags.
assert(export_flags & macho.EXPORT_SYMBOL_FLAGS_REEXPORT == 0 and assert(export_flags & macho.EXPORT_SYMBOL_FLAGS_REEXPORT == 0 and
export_flags & macho.EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER == 0); export_flags & macho.EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER == 0);
try leb.writeULEB128(info_stream.writer(), export_flags); try leb.writeUleb128(info_stream.writer(), export_flags);
try leb.writeULEB128(info_stream.writer(), vmaddr_offset); try leb.writeUleb128(info_stream.writer(), vmaddr_offset);
// Encode the size of the terminal node info. // Encode the size of the terminal node info.
var size_buf: [@sizeOf(u64)]u8 = undefined; var size_buf: [@sizeOf(u64)]u8 = undefined;
var size_stream = std.io.fixedBufferStream(&size_buf); var size_stream = std.io.fixedBufferStream(&size_buf);
try leb.writeULEB128(size_stream.writer(), info_stream.pos); try leb.writeUleb128(size_stream.writer(), info_stream.pos);
// Now, write them to the output stream. // Now, write them to the output stream.
try writer.writeAll(size_buf[0..size_stream.pos]); try writer.writeAll(size_buf[0..size_stream.pos]);
@ -274,7 +274,7 @@ fn writeNode(self: *Trie, node_index: Node.Index, writer: anytype) !void {
// Write edge label and offset to next node in trie. // Write edge label and offset to next node in trie.
try writer.writeAll(edge.label); try writer.writeAll(edge.label);
try writer.writeByte(0); try writer.writeByte(0);
try leb.writeULEB128(writer, slice.items(.trie_offset)[edge.node]); try leb.writeUleb128(writer, slice.items(.trie_offset)[edge.node]);
} }
} }

View File

@ -146,7 +146,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
const int_tag_ty = Zcu.Type.fromInterned(data.ip_index).intTagType(zcu); const int_tag_ty = Zcu.Type.fromInterned(data.ip_index).intTagType(zcu);
gop.value_ptr.* = .{ .tag_name = .{ gop.value_ptr.* = .{ .tag_name = .{
.symbol_name = try wasm.internStringFmt("__zig_tag_name_{d}", .{@intFromEnum(data.ip_index)}), .symbol_name = try wasm.internStringFmt("__zig_tag_name_{d}", .{@intFromEnum(data.ip_index)}),
.type_index = try wasm.internFunctionType(.Unspecified, &.{int_tag_ty.ip_index}, .slice_const_u8_sentinel_0, target), .type_index = try wasm.internFunctionType(.auto, &.{int_tag_ty.ip_index}, .slice_const_u8_sentinel_0, target),
.table_index = @intCast(wasm.tag_name_offs.items.len), .table_index = @intCast(wasm.tag_name_offs.items.len),
} }; } };
try wasm.functions.put(gpa, .fromZcuFunc(wasm, @enumFromInt(gop.index)), {}); try wasm.functions.put(gpa, .fromZcuFunc(wasm, @enumFromInt(gop.index)), {});

View File

@ -153,9 +153,9 @@ test "extern struct with stdcallcc fn pointer" {
if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
const S = extern struct { const S = extern struct {
ptr: *const fn () callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .c) i32, ptr: *const fn () callconv(if (builtin.target.cpu.arch == .x86) .{ .x86_stdcall = .{} } else .c) i32,
fn foo() callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .c) i32 { fn foo() callconv(if (builtin.target.cpu.arch == .x86) .{ .x86_stdcall = .{} } else .c) i32 {
return 1234; return 1234;
} }
}; };
@ -170,8 +170,8 @@ fn fComplexCallconvRet(x: u32) callconv(blk: {
const s: struct { n: u32 } = .{ .n = nComplexCallconv }; const s: struct { n: u32 } = .{ .n = nComplexCallconv };
break :blk switch (s.n) { break :blk switch (s.n) {
0 => .c, 0 => .c,
1 => .Inline, 1 => .@"inline",
else => .Unspecified, else => .auto,
}; };
}) struct { x: u32 } { }) struct { x: u32 } {
return .{ .x = x * x }; return .{ .x = x * x };

View File

@ -670,7 +670,7 @@ test "reified function type params initialized with field pointer" {
}; };
const Bar = @Type(.{ const Bar = @Type(.{
.@"fn" = .{ .@"fn" = .{
.calling_convention = .Unspecified, .calling_convention = .auto,
.is_generic = false, .is_generic = false,
.is_var_args = false, .is_var_args = false,
.return_type = void, .return_type = void,

View File

@ -5763,7 +5763,7 @@ test "f128 f128 struct" {
} }
// The stdcall attribute on C functions is ignored when compiled on non-x86 // The stdcall attribute on C functions is ignored when compiled on non-x86
const stdcall_callconv: std.builtin.CallingConvention = if (builtin.cpu.arch == .x86) .Stdcall else .C; const stdcall_callconv: std.builtin.CallingConvention = if (builtin.cpu.arch == .x86) .{ .x86_stdcall = .{} } else .c;
extern fn stdcall_scalars(i8, i16, i32, f32, f64) callconv(stdcall_callconv) void; extern fn stdcall_scalars(i8, i16, i32, f32, f64) callconv(stdcall_callconv) void;
test "Stdcall ABI scalars" { test "Stdcall ABI scalars" {

View File

@ -1,4 +1,4 @@
var cc: @import("std").builtin.CallingConvention = .C; var cc: @import("std").builtin.CallingConvention = .c;
export fn foo() callconv(cc) void {} export fn foo() callconv(cc) void {}
// error // error

View File

@ -12,5 +12,5 @@ fn foo(set1: Set1) void {
// backend=stage2 // backend=stage2
// target=native // target=native
// //
// :7:21: error: expected type 'error{C,A}', found 'error{A,B}' // :7:21: error: expected type 'error{A,C}', found 'error{A,B}'
// :7:21: note: 'error.B' not a member of destination error set // :7:21: note: 'error.B' not a member of destination error set

View File

@ -1,6 +1,6 @@
const Foo = @Type(.{ const Foo = @Type(.{
.@"fn" = .{ .@"fn" = .{
.calling_convention = .Unspecified, .calling_convention = .auto,
.is_generic = true, .is_generic = true,
.is_var_args = false, .is_var_args = false,
.return_type = u0, .return_type = u0,

View File

@ -1,6 +1,6 @@
const Foo = @Type(.{ const Foo = @Type(.{
.@"fn" = .{ .@"fn" = .{
.calling_convention = .Unspecified, .calling_convention = .auto,
.is_generic = false, .is_generic = false,
.is_var_args = true, .is_var_args = true,
.return_type = u0, .return_type = u0,

View File

@ -1,6 +1,6 @@
const Foo = @Type(.{ const Foo = @Type(.{
.@"fn" = .{ .@"fn" = .{
.calling_convention = .Unspecified, .calling_convention = .auto,
.is_generic = false, .is_generic = false,
.is_var_args = false, .is_var_args = false,
.return_type = null, .return_type = null,

View File

@ -90,19 +90,21 @@ pub fn addCase(self: *LlvmIr, case: TestCase) void {
const obj = self.b.addObject(.{ const obj = self.b.addObject(.{
.name = "test", .name = "test",
.root_source_file = self.b.addWriteFiles().add("test.zig", case.source), .root_module = self.b.createModule(.{
.use_llvm = true, .root_source_file = self.b.addWriteFiles().add("test.zig", case.source),
.code_model = case.params.code_model, .code_model = case.params.code_model,
.error_tracing = case.params.error_tracing, .error_tracing = case.params.error_tracing,
.omit_frame_pointer = case.params.omit_frame_pointer, .omit_frame_pointer = case.params.omit_frame_pointer,
.optimize = case.params.optimize, .optimize = case.params.optimize,
.pic = case.params.pic, .pic = case.params.pic,
.sanitize_thread = case.params.sanitize_thread, .sanitize_thread = case.params.sanitize_thread,
.single_threaded = case.params.single_threaded, .single_threaded = case.params.single_threaded,
.strip = case.params.strip, .strip = case.params.strip,
.target = target, .target = target,
.unwind_tables = case.params.unwind_tables, .unwind_tables = case.params.unwind_tables,
}),
.use_llvm = true,
}); });
obj.dll_export_fns = case.params.dll_export_fns; obj.dll_export_fns = case.params.dll_export_fns;

View File

@ -8,8 +8,10 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "test", .name = "test",
.target = b.graph.host, .root_module = b.createModule(.{
.optimize = optimize, .target = b.graph.host,
.optimize = optimize,
}),
}); });
exe.addCSourceFile(.{ exe.addCSourceFile(.{
.file = b.path("test.c"), .file = b.path("test.c"),

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub fn build(b: *std.Build) void { pub fn build(b: *std.Build) void {
const config_header = b.addConfigHeader( const config_header = b.addConfigHeader(
.{ .style = .{ .autoconf = b.path("config.h.in") } }, .{ .style = .{ .autoconf_undef = b.path("config.h.in") } },
.{ .{
.SOME_NO = null, .SOME_NO = null,
.SOME_TRUE = true, .SOME_TRUE = true,

View File

@ -10,7 +10,7 @@ const mem = std.mem;
const testing = std.testing; const testing = std.testing;
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const getExternalExecutor = std.zig.system.getExternalExecutor; const getExternalExecutor = std.zig.system.getExternalExecutor;
const fatal = std.zig.fatal; const fatal = std.process.fatal;
const max_doc_file_size = 10 * 1024 * 1024; const max_doc_file_size = 10 * 1024 * 1024;

View File

@ -1,6 +1,6 @@
const builtin = @import("builtin"); const builtin = @import("builtin");
const std = @import("std"); const std = @import("std");
const fatal = std.zig.fatal; const fatal = std.process.fatal;
const mem = std.mem; const mem = std.mem;
const fs = std.fs; const fs = std.fs;
const process = std.process; const process = std.process;

View File

@ -7,7 +7,7 @@ const mem = std.mem;
const testing = std.testing; const testing = std.testing;
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const max_doc_file_size = 10 * 1024 * 1024; const max_doc_file_size = 10 * 1024 * 1024;
const fatal = std.zig.fatal; const fatal = std.process.fatal;
pub fn main() !void { pub fn main() !void {
var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator);