From a430853a48a5e4dbcd0094c632957e28898159f3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 18 Jun 2018 17:43:01 -0400 Subject: [PATCH] standard library fixes --- src/ir.cpp | 2 +- std/cstr.zig | 2 +- std/os/index.zig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ir.cpp b/src/ir.cpp index c5ca12af1e..3ed9f66947 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -10215,7 +10215,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst } } - // explicit cast from [N]T to &const []const N + // explicit cast from [N]T to &const []const T if (wanted_type->id == TypeTableEntryIdPointer && wanted_type->data.pointer.is_const && is_slice(wanted_type->data.pointer.child_type) && diff --git a/std/cstr.zig b/std/cstr.zig index d9106769c1..e83d5a39e9 100644 --- a/std/cstr.zig +++ b/std/cstr.zig @@ -79,7 +79,7 @@ pub const NullTerminated2DArray = struct { errdefer allocator.free(buf); var write_index = index_size; - const index_buf = ([]?[*]u8)(buf); + const index_buf = @bytesToSlice(?[*]u8, buf); var i: usize = 0; for (slices) |slice| { diff --git a/std/os/index.zig b/std/os/index.zig index f1c3ab2128..dd0d4e2ea1 100644 --- a/std/os/index.zig +++ b/std/os/index.zig @@ -1805,7 +1805,7 @@ pub fn argsAlloc(allocator: *mem.Allocator) ![]const []u8 { const buf = try allocator.alignedAlloc(u8, @alignOf([]u8), total_bytes); errdefer allocator.free(buf); - const result_slice_list = ([][]u8)(buf[0..slice_list_bytes]); + const result_slice_list = @bytesToSlice([]u8, buf[0..slice_list_bytes]); const result_contents = buf[slice_list_bytes..]; mem.copy(u8, result_contents, contents_slice);