zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a430853a48a5e4dbcd0094c632957e28898159f3 (tree)
parent 1aafbae5be518309b4c2194cdc24e22642514519
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Mon, 18 Jun 2018 17:43:01 -0400

standard library fixes

Diffstat:
Msrc/ir.cpp | 2+-
Mstd/cstr.zig | 2+-
Mstd/os/index.zig | 2+-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git 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 @@ -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 @@ -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);