Compare commits

..

1 commit

Author SHA1 Message Date
Jay Petacat
fc74ffbe9d std.mem.sliceTo: Return slice with sentinel from unbounded pointers
Commit dec1163fbb removed sentinels from the returned slice for C
pointers. Since C pointers have no bounds, we know that it'll keep
scanning until it finds `end` (or crash trying). The same is also true
of many-item pointers without a sentinel (e.g. `[*]T`), so I added
support for those too.
2025-12-04 20:40:38 +01:00
9 changed files with 19 additions and 23 deletions

View file

@ -152,7 +152,7 @@ jobs:
fetch-depth: 0
- name: Build and Test
run: sh ci/x86_64-linux-debug.sh
timeout-minutes: 180
timeout-minutes: 240
x86_64-linux-debug-llvm:
runs-on: [self-hosted, x86_64-linux]
steps:
@ -162,7 +162,7 @@ jobs:
fetch-depth: 0
- name: Build and Test
run: sh ci/x86_64-linux-debug-llvm.sh
timeout-minutes: 360
timeout-minutes: 480
x86_64-linux-release:
runs-on: [self-hosted, x86_64-linux]
steps:
@ -172,7 +172,7 @@ jobs:
fetch-depth: 0
- name: Build and Test
run: sh ci/x86_64-linux-release.sh
timeout-minutes: 360
timeout-minutes: 480
x86_64-windows-debug:
runs-on: [self-hosted, x86_64-windows]

View file

@ -485,14 +485,16 @@ interpret your words.
### Find a Contributor Friendly Issue
The issue label
[Contributor Friendly](https://codeberg.org/ziglang/zig/issues?labels=741726&state=open)
[Contributor Friendly](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3A%22contributor+friendly%22)
exists to help you find issues that are **limited in scope and/or
knowledge of Zig internals.**
Please note that issues labeled
[Proposal: Proposed](https://codeberg.org/ziglang/zig/issues?labels=746937&state=open)
are still under consideration, and efforts to implement such a proposal have
a high risk of being wasted. If you are interested in a proposal which is
[Proposal](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aproposal)
but do not also have the
[Accepted](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aaccepted)
label are still under consideration, and efforts to implement such a proposal
have a high risk of being wasted. If you are interested in a proposal which is
still under consideration, please express your interest in the issue tracker,
providing extra insights and considerations that others have not yet expressed.
The most highly regarded argument in such a discussion is a real world use case.
@ -775,7 +777,7 @@ If you will be debugging the Zig compiler itself, or if you will be debugging
any project compiled with Zig's LLVM backend (not recommended with the LLDB
fork, prefer vanilla LLDB with a version that matches the version of LLVM that
Zig is using), you can get a better debugging experience by using
[`lldb_pretty_printers.py`](https://codeberg.org/ziglang/zig/src/branch/master/tools/lldb_pretty_printers.py).
[`lldb_pretty_printers.py`](https://github.com/ziglang/zig/blob/master/tools/lldb_pretty_printers.py).
Put this line in `~/.lldbinit`:

View file

@ -39,7 +39,7 @@ v2.2.5.
The file `lib/libc/glibc/abilist` is a Zig-specific binary blob that
defines the supported glibc versions and the set of symbols each version
must define. See https://codeberg.org/ziglang/libc-abi-tools for the
must define. See https://github.com/ziglang/glibc-abi-tool for the
tooling to generate this blob. The code in `glibc.zig` parses the abilist
to build version-specific stub libraries on demand.

View file

@ -79,7 +79,7 @@ enable_rosetta: bool = false,
enable_wasmtime: bool = false,
/// Use system Wine installation to run cross compiled Windows build artifacts.
enable_wine: bool = false,
/// After following the steps in https://codeberg.org/ziglang/infra/src/branch/master/libc-update/glibc.md,
/// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
/// this will be the directory $glibc-build-dir/install/glibcs
/// Given the example of the aarch64 target, this is the directory
/// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`.

View file

@ -890,7 +890,7 @@ pub const Timestamp = struct {
}
pub fn withClock(t: Timestamp, clock: Clock) Clock.Timestamp {
return .{ .raw = t, .clock = clock };
return .{ .nanoseconds = t.nanoseconds, .clock = clock };
}
pub fn fromNanoseconds(x: i96) Timestamp {

View file

@ -1090,8 +1090,7 @@ pub const Socket = struct {
}
pub fn sendMany(s: *const Socket, io: Io, messages: []OutgoingMessage, flags: SendFlags) SendError!void {
const err, const n = io.vtable.netSend(io.userdata, s.handle, messages, flags);
if (n != messages.len) return err.?;
return io.vtable.netSend(io.userdata, s.handle, messages, flags);
}
pub const ReceiveError = error{

View file

@ -1604,13 +1604,6 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
test "manage resources correctly" {
if (SelfInfo == void) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c) {
// The C backend emits an extremely large C source file, meaning it has a huge
// amount of debug information. Parsing this debug information makes this test
// take too long to be worth running.
return error.SkipZigTest;
}
const S = struct {
noinline fn showMyTrace() usize {
return @returnAddress();

View file

@ -962,7 +962,7 @@ test sliceTo {
try testing.expectEqualSlices(u16, array[0..2], sliceTo(&array, 3));
try testing.expectEqualSlices(u16, array[0..2], sliceTo(array[0..3], 3));
const many_ptr: [*]u16 = &array;
const many_ptr = @as([*]u16, @ptrCast(&array));
try testing.expectEqualSlices(u16, array[0..2], sliceTo(many_ptr, 3));
try testing.expectEqual([:3]u16, @TypeOf(sliceTo(many_ptr, 3)));
@ -1025,7 +1025,9 @@ fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize {
while (ptr[i] != end and ptr[i] != s) i += 1;
return i;
} else {
return indexOfSentinel(ptr_info.child, end, @ptrCast(ptr));
var i: usize = 0;
while (ptr[i] != end) i += 1;
return i;
},
.c => {
assert(ptr != null);

View file

@ -1,6 +1,6 @@
//! This script updates the .c, .h, .s, and .S files that make up the start
//! files such as crt1.o. Not to be confused with
//! https://codeberg.org/ziglang/libc-abi-tools which updates the `abilists`
//! https://github.com/ziglang/glibc-abi-tool/ which updates the `abilists`
//! file.
//!
//! Example usage: