aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorInKryption <inkryption07@gmail.com>2022-09-16 18:34:51 +0200
committerAndrew Kelley <andrew@ziglang.org>2022-10-27 22:00:47 -0400
commitbc72ae5e4e6d8f2253aed1316b053ad1022f9f67 (patch)
treeaa16a922bb65a479409d94c743880b6909b61112 /lib/std
parent1d1c7ae5de3e981099522a8610764a6595b1b7a1 (diff)
downloadzig-bc72ae5e4e6d8f2253aed1316b053ad1022f9f67.tar.gz
zig-bc72ae5e4e6d8f2253aed1316b053ad1022f9f67.zip
Sema: Prevent coercion from tuple pointer to mutable slice.
Also fix some stdlib code affected by this. Co-authored by: topolarity <topolarity@tapscott.me>
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/fs/wasi.zig2
-rw-r--r--lib/std/x/net/bpf.zig4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/fs/wasi.zig b/lib/std/fs/wasi.zig
index 81a43062dc..522731ef02 100644
--- a/lib/std/fs/wasi.zig
+++ b/lib/std/fs/wasi.zig
@@ -201,7 +201,7 @@ pub const PreopenList = struct {
// If we were provided a CWD root to resolve against, we try to treat Preopen dirs as
// POSIX paths, relative to "/" or `cwd_root` depending on whether they start with "."
const path = if (cwd_root) |cwd| blk: {
- const resolve_paths: [][]const u8 = if (raw_path[0] == '.') &.{ cwd, raw_path } else &.{ "/", raw_path };
+ const resolve_paths: []const []const u8 = if (raw_path[0] == '.') &.{ cwd, raw_path } else &.{ "/", raw_path };
break :blk fs.path.resolve(self.buffer.allocator, resolve_paths) catch |err| switch (err) {
error.CurrentWorkingDirectoryUnlinked => unreachable, // root is absolute, so CWD not queried
else => |e| return e,
diff --git a/lib/std/x/net/bpf.zig b/lib/std/x/net/bpf.zig
index e8db9a3e0e..8fd318b03b 100644
--- a/lib/std/x/net/bpf.zig
+++ b/lib/std/x/net/bpf.zig
@@ -691,14 +691,14 @@ test "tcpdump filter" {
);
}
-fn expectPass(data: anytype, filter: []Insn) !void {
+fn expectPass(data: anytype, filter: []const Insn) !void {
try expectEqual(
@as(u32, 0),
try simulate(mem.asBytes(data), filter, .Big),
);
}
-fn expectFail(expected_error: anyerror, data: anytype, filter: []Insn) !void {
+fn expectFail(expected_error: anyerror, data: anytype, filter: []const Insn) !void {
try expectError(
expected_error,
simulate(mem.asBytes(data), filter, native_endian),