From faf2fd18d33de246c5bb03905f25290108e1dd30 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sun, 22 Jan 2023 17:34:38 +0100 Subject: std: eliminate pointless meta.assumeSentinel() usage This fixes a bug in std.net caused during the introduction of meta.assumeSentinel due to the unfortunate semantics of mem.span() This leaves only 3 remaining uses of meta.assumeSentinel() in the standard library, each of which could be a simple @ptrCast([*:0]T, foo) instead. I think this function should likely be removed. --- lib/std/debug.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/std/debug.zig') diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 99ddb266b6..3708c4fe81 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -978,7 +978,7 @@ pub fn readElfDebugInfo(allocator: mem.Allocator, elf_file: File) !ModuleDebugIn for (shdrs) |*shdr| { if (shdr.sh_type == elf.SHT_NULL) continue; - const name = std.mem.span(std.meta.assumeSentinel(header_strings[shdr.sh_name..].ptr, 0)); + const name = mem.sliceTo(header_strings[shdr.sh_name..], 0); if (mem.eql(u8, name, ".debug_info")) { opt_debug_info = try chopSlice(mapped_mem, shdr.sh_offset, shdr.sh_size); } else if (mem.eql(u8, name, ".debug_abbrev")) { -- cgit v1.2.3