Commit a430853a48

Andrew Kelley <superjoe30@gmail.com>
2018-06-18 23:43:01
standard library fixes
1 parent 1aafbae
Changed files (3)
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) &&
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);
 
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| {