| author | |
| committer | |
| log | e966d0c385a1557e5e56f042943770d1a0aeb9f9 |
| tree | 460fd0c0b77336e160a63cc969c8d40f9e9993d9 |
| parent | 0ff175b69ef806f421820d33dade7a8163fe3f16 |
| parent | fd63f57cd86ebcf1261b10d1a17e62d523e70981 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32060
Reviewed-by: Andrew Kelley <andrew@ziglang.org>14 files changed, 33 insertions(+), 24 deletions(-)
doc/langref/test_peer_type_resolution.zig+2-2| ... | ... | @@ -96,8 +96,8 @@ fn peerTypeEmptyArrayAndSliceAndError(a: bool, slice: []u8) anyerror![]u8 { |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | test "peer type resolution: *const T and ?*T" { |
| 99 | const a: *const usize = @ptrFromInt(0x123456780); | |
| 100 | const b: ?*usize = @ptrFromInt(0x123456780); | |
| 99 | const a: *const usize = @ptrFromInt(0x12345678); | |
| 100 | const b: ?*usize = @ptrFromInt(0x12345678); | |
| 101 | 101 | try expectEqual(a, b); |
| 102 | 102 | try expectEqual(b, a); |
| 103 | 103 | } |
lib/compiler/Maker.zig+2-2| ... | ... | @@ -38,7 +38,7 @@ steps: []Step, |
| 38 | 38 | generated_files: []Path, |
| 39 | 39 | run_args: ?[]const []const u8, |
| 40 | 40 | |
| 41 | available_rss: usize, | |
| 41 | available_rss: u64, | |
| 42 | 42 | max_rss_is_default: bool, |
| 43 | 43 | max_rss_mutex: Io.Mutex, |
| 44 | 44 | skip_oom_steps: bool, |
| ... | ... | @@ -740,7 +740,7 @@ fn prepare(maker: *Maker, step_names: []const []const u8) !void { |
| 740 | 740 | { |
| 741 | 741 | // Check that we have enough memory to complete the build. |
| 742 | 742 | var any_problems = false; |
| 743 | var max_needed: usize = 0; | |
| 743 | var max_needed: u64 = 0; | |
| 744 | 744 | for (step_stack.keys()) |step_index| { |
| 745 | 745 | const make_step = maker.stepByIndex(step_index); |
| 746 | 746 | const conf_step = step_index.ptr(c); |
lib/compiler/Maker/Step/Run.zig+2-2| ... | ... | @@ -1460,7 +1460,7 @@ fn evalGeneric( |
| 1460 | 1460 | stderr_bytes = try multi_reader.toOwnedSlice(1); |
| 1461 | 1461 | } else { |
| 1462 | 1462 | var stdout_reader = stdout.readerStreaming(io, &.{}); |
| 1463 | const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited(x) else .unlimited; | |
| 1463 | const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited64(x) else .unlimited; | |
| 1464 | 1464 | stdout_bytes = stdout_reader.interface.allocRemaining(arena, stdio_limit) catch |err| switch (err) { |
| 1465 | 1465 | error.OutOfMemory => |e| return e, |
| 1466 | 1466 | error.ReadFailed => return stdout_reader.err.?, |
| ... | ... | @@ -1469,7 +1469,7 @@ fn evalGeneric( |
| 1469 | 1469 | } |
| 1470 | 1470 | } else if (child.stderr) |stderr| { |
| 1471 | 1471 | var stderr_reader = stderr.readerStreaming(io, &.{}); |
| 1472 | const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited(x) else .unlimited; | |
| 1472 | const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited64(x) else .unlimited; | |
| 1473 | 1473 | stderr_bytes = stderr_reader.interface.allocRemaining(arena, stdio_limit) catch |err| switch (err) { |
| 1474 | 1474 | error.OutOfMemory => |e| return e, |
| 1475 | 1475 | error.ReadFailed => return stderr_reader.err.?, |
lib/compiler/Maker/WebServer.zig+2-2| ... | ... | @@ -876,8 +876,8 @@ pub fn updateTimeReportRunTest( |
| 876 | 876 | assert(tests.names.len == ns_per_test.len); |
| 877 | 877 | const tests_len: u32 = @intCast(tests.names.len); |
| 878 | 878 | |
| 879 | const new_len: u64 = len: { | |
| 880 | var names_len: u64 = 0; | |
| 879 | const new_len: usize = len: { | |
| 880 | var names_len: usize = 0; | |
| 881 | 881 | for (0..tests_len) |i| { |
| 882 | 882 | names_len += tests.testName(@intCast(i)).len + 1; |
| 883 | 883 | } |
lib/compiler/configurer.zig+1-1| ... | ... | @@ -1074,7 +1074,7 @@ fn serialize(b: *std.Build, wc: *Configuration.Wip, writer: *Io.Writer) !void { |
| 1074 | 1074 | } else null }, |
| 1075 | 1075 | .environ_map = .{ .value = try s.addEnvironMap(run.environ_map) }, |
| 1076 | 1076 | .expect_term_value = .{ .value = if (expect_term) |t| t.value else null }, |
| 1077 | .stdio_limit = .{ .value = run.stdio_limit.toInt() }, | |
| 1077 | .stdio_limit = .{ .value = run.stdio_limit.toInt64() }, | |
| 1078 | 1078 | .producer = .{ .value = if (run.producer) |cs| s.stepIndex(&cs.step) else null }, |
| 1079 | 1079 | .expect_stderr_exact = .{ .value = if (expect_stderr_exact) |bytes| bytes else null }, |
| 1080 | 1080 | .expect_stdout_exact = .{ .value = if (expect_stdout_exact) |bytes| bytes else null }, |
lib/std/Build.zig+5-5| ... | ... | @@ -692,7 +692,7 @@ pub const ExecutableOptions = struct { |
| 692 | 692 | root_module: *Module, |
| 693 | 693 | version: ?std.SemanticVersion = null, |
| 694 | 694 | linkage: ?std.builtin.LinkMode = null, |
| 695 | max_rss: usize = 0, | |
| 695 | max_rss: u64 = 0, | |
| 696 | 696 | use_llvm: ?bool = null, |
| 697 | 697 | use_lld: ?bool = null, |
| 698 | 698 | zig_lib_dir: ?LazyPath = null, |
| ... | ... | @@ -722,7 +722,7 @@ pub fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile { |
| 722 | 722 | pub const ObjectOptions = struct { |
| 723 | 723 | name: []const u8, |
| 724 | 724 | root_module: *Module, |
| 725 | max_rss: usize = 0, | |
| 725 | max_rss: u64 = 0, | |
| 726 | 726 | use_llvm: ?bool = null, |
| 727 | 727 | use_lld: ?bool = null, |
| 728 | 728 | zig_lib_dir: ?LazyPath = null, |
| ... | ... | @@ -745,7 +745,7 @@ pub const LibraryOptions = struct { |
| 745 | 745 | name: []const u8, |
| 746 | 746 | root_module: *Module, |
| 747 | 747 | version: ?std.SemanticVersion = null, |
| 748 | max_rss: usize = 0, | |
| 748 | max_rss: u64 = 0, | |
| 749 | 749 | use_llvm: ?bool = null, |
| 750 | 750 | use_lld: ?bool = null, |
| 751 | 751 | zig_lib_dir: ?LazyPath = null, |
| ... | ... | @@ -778,7 +778,7 @@ pub fn addLibrary(b: *Build, options: LibraryOptions) *Step.Compile { |
| 778 | 778 | pub const TestOptions = struct { |
| 779 | 779 | name: []const u8 = "test", |
| 780 | 780 | root_module: *Module, |
| 781 | max_rss: usize = 0, | |
| 781 | max_rss: u64 = 0, | |
| 782 | 782 | filters: []const []const u8 = &.{}, |
| 783 | 783 | test_runner: ?Step.Compile.TestRunner = null, |
| 784 | 784 | use_llvm: ?bool = null, |
| ... | ... | @@ -819,7 +819,7 @@ pub const AssemblyOptions = struct { |
| 819 | 819 | /// `host` field of the package's `Build` instance. |
| 820 | 820 | target: ResolvedTarget, |
| 821 | 821 | optimize: std.builtin.OptimizeMode, |
| 822 | max_rss: usize = 0, | |
| 822 | max_rss: u64 = 0, | |
| 823 | 823 | zig_lib_dir: ?LazyPath = null, |
| 824 | 824 | }; |
| 825 | 825 |
lib/std/Build/Configuration.zig+2-2| ... | ... | @@ -1458,12 +1458,12 @@ pub const MaxRss = enum(u32) { |
| 1458 | 1458 | none = 0, |
| 1459 | 1459 | _, |
| 1460 | 1460 | |
| 1461 | pub fn toBytes(mr: MaxRss) usize { | |
| 1461 | pub fn toBytes(mr: MaxRss) u64 { | |
| 1462 | 1462 | const x: usize = @intFromEnum(mr); |
| 1463 | 1463 | return x << 8; |
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | pub fn fromBytes(bytes: usize) MaxRss { | |
| 1466 | pub fn fromBytes(bytes: u64) MaxRss { | |
| 1467 | 1467 | return @enumFromInt(bytes >> 8); |
| 1468 | 1468 | } |
| 1469 | 1469 | }; |
lib/std/Build/Step.zig+2-2| ... | ... | @@ -30,7 +30,7 @@ dependencies: std.ArrayList(*Step), |
| 30 | 30 | /// max_rss value that does not exceed the `max_total_rss` value of the build |
| 31 | 31 | /// runner. This value is configurable on the command line, and defaults to the |
| 32 | 32 | /// total system memory available. |
| 33 | max_rss: usize, | |
| 33 | max_rss: u64, | |
| 34 | 34 | |
| 35 | 35 | /// The return address associated with creation of this step that can be useful |
| 36 | 36 | /// to print along with debugging messages. |
| ... | ... | @@ -87,7 +87,7 @@ pub const StepOptions = struct { |
| 87 | 87 | name: []const u8, |
| 88 | 88 | owner: *Build, |
| 89 | 89 | first_ret_addr: ?usize = null, |
| 90 | max_rss: usize = 0, | |
| 90 | max_rss: u64 = 0, | |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | 93 | pub fn init(options: StepOptions) Step { |
lib/std/Build/Step/Compile.zig+1-1| ... | ... | @@ -269,7 +269,7 @@ pub const Options = struct { |
| 269 | 269 | kind: Kind, |
| 270 | 270 | linkage: ?std.builtin.LinkMode = null, |
| 271 | 271 | version: ?std.SemanticVersion = null, |
| 272 | max_rss: usize = 0, | |
| 272 | max_rss: u64 = 0, | |
| 273 | 273 | filters: []const []const u8 = &.{}, |
| 274 | 274 | test_runner: ?TestRunner = null, |
| 275 | 275 | use_llvm: ?bool = null, |
lib/std/Io.zig+7| ... | ... | @@ -689,6 +689,13 @@ pub const Limit = enum(usize) { |
| 689 | 689 | }; |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | pub fn toInt64(l: Limit) ?u64 { | |
| 693 | return switch (l) { | |
| 694 | else => @intFromEnum(l), | |
| 695 | .unlimited => null, | |
| 696 | }; | |
| 697 | } | |
| 698 | ||
| 692 | 699 | /// Reduces a slice to account for the limit, leaving room for one extra |
| 693 | 700 | /// byte above the limit, allowing for the use case of differentiating |
| 694 | 701 | /// between end-of-stream and reaching the limit. |
lib/std/elf.zig+2-2| ... | ... | @@ -873,8 +873,8 @@ pub const ProgramHeaderBufferIterator = struct { |
| 873 | 873 | if (it.index >= it.phnum) return null; |
| 874 | 874 | defer it.index += 1; |
| 875 | 875 | |
| 876 | const size: u64 = if (it.is_64) @sizeOf(Elf64_Phdr) else @sizeOf(Elf32_Phdr); | |
| 877 | const offset = it.phoff + size * it.index; | |
| 876 | const size: usize = if (it.is_64) @sizeOf(Elf64_Phdr) else @sizeOf(Elf32_Phdr); | |
| 877 | const offset = @as(usize, @intCast(it.phoff)) + size * it.index; | |
| 878 | 878 | var reader = Io.Reader.fixed(it.buf[offset..]); |
| 879 | 879 | |
| 880 | 880 | return try takeProgramHeader(&reader, it.is_64, it.endian); |
src/main.zig+2| ... | ... | @@ -5133,6 +5133,7 @@ fn cmdBuild( |
| 5133 | 5133 | } else { |
| 5134 | 5134 | warn("Zig was compiled without debug extensions. --debug-target has no effect.", .{}); |
| 5135 | 5135 | } |
| 5136 | continue; | |
| 5136 | 5137 | } else if (mem.eql(u8, arg, "--debug-libc")) { |
| 5137 | 5138 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 5138 | 5139 | i += 1; |
| ... | ... | @@ -5141,6 +5142,7 @@ fn cmdBuild( |
| 5141 | 5142 | } else { |
| 5142 | 5143 | warn("Zig was compiled without debug extensions. --debug-libc has no effect.", .{}); |
| 5143 | 5144 | } |
| 5145 | continue; | |
| 5144 | 5146 | } else if (mem.eql(u8, arg, "--verbose-link")) { |
| 5145 | 5147 | verbose_link = true; |
| 5146 | 5148 | } else if (mem.eql(u8, arg, "--verbose-cc")) { |
test/src/Libc.zig+1-1| ... | ... | @@ -11,7 +11,7 @@ pub const Options = struct { |
| 11 | 11 | test_filters: []const []const u8, |
| 12 | 12 | test_target_filters: []const []const u8, |
| 13 | 13 | skip_wasm: bool, |
| 14 | max_rss: usize, | |
| 14 | max_rss: u64, | |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | 17 | const TestCase = struct { |
test/tests.zig+2-2| ... | ... | @@ -2467,7 +2467,7 @@ pub const ModuleTestOptions = struct { |
| 2467 | 2467 | skip_linux: bool, |
| 2468 | 2468 | skip_llvm: bool, |
| 2469 | 2469 | skip_libc: bool, |
| 2470 | max_rss: usize = 0, | |
| 2470 | max_rss: u64 = 0, | |
| 2471 | 2471 | no_builtin: bool = false, |
| 2472 | 2472 | sanitize_thread: ?bool = null, |
| 2473 | 2473 | build_options: ?*Step.Options = null, |
| ... | ... | @@ -2795,7 +2795,7 @@ const CAbiTestOptions = struct { |
| 2795 | 2795 | skip_darwin: bool, |
| 2796 | 2796 | skip_linux: bool, |
| 2797 | 2797 | skip_llvm: bool, |
| 2798 | max_rss: usize = 0, | |
| 2798 | max_rss: u64 = 0, | |
| 2799 | 2799 | }; |
| 2800 | 2800 | |
| 2801 | 2801 | pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { |