diff --git a/doc/docgen.zig b/doc/docgen.zig index 5d216a1914..2158cdccae 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -1039,7 +1039,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var const name_plus_ext = try std.fmt.allocPrint(allocator, "{}.zig", code.name); const tmp_source_file_name = try fs.path.join( allocator, - [_][]const u8{ tmp_dir_name, name_plus_ext }, + &[_][]const u8{ tmp_dir_name, name_plus_ext }, ); try io.writeFile(tmp_source_file_name, trimmed_raw_source); @@ -1048,7 +1048,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var const name_plus_bin_ext = try std.fmt.allocPrint(allocator, "{}{}", code.name, exe_ext); var build_args = std.ArrayList([]const u8).init(allocator); defer build_args.deinit(); - try build_args.appendSlice([_][]const u8{ + try build_args.appendSlice(&[_][]const u8{ zig_exe, "build-exe", tmp_source_file_name, @@ -1079,7 +1079,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var const name_with_ext = try std.fmt.allocPrint(allocator, "{}{}", link_object, obj_ext); const full_path_object = try fs.path.join( allocator, - [_][]const u8{ tmp_dir_name, name_with_ext }, + &[_][]const u8{ tmp_dir_name, name_with_ext }, ); try build_args.append("--object"); try build_args.append(full_path_object); @@ -1090,7 +1090,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var try out.print(" -lc"); } if (code.target_str) |triple| { - try build_args.appendSlice([_][]const u8{ "-target", triple }); + try build_args.appendSlice(&[_][]const u8{ "-target", triple }); if (!code.is_inline) { try out.print(" -target {}", triple); } @@ -1143,7 +1143,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var } const path_to_exe = mem.trim(u8, exec_result.stdout, " \r\n"); - const run_args = [_][]const u8{path_to_exe}; + const run_args = &[_][]const u8{path_to_exe}; var exited_with_signal = false; @@ -1184,7 +1184,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var var test_args = std.ArrayList([]const u8).init(allocator); defer test_args.deinit(); - try test_args.appendSlice([_][]const u8{ + try test_args.appendSlice(&[_][]const u8{ zig_exe, "test", tmp_source_file_name, @@ -1212,7 +1212,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var try out.print(" -lc"); } if (code.target_str) |triple| { - try test_args.appendSlice([_][]const u8{ "-target", triple }); + try test_args.appendSlice(&[_][]const u8{ "-target", triple }); try out.print(" -target {}", triple); } const result = exec(allocator, &env_map, test_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "test failed"); @@ -1224,7 +1224,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var var test_args = std.ArrayList([]const u8).init(allocator); defer test_args.deinit(); - try test_args.appendSlice([_][]const u8{ + try test_args.appendSlice(&[_][]const u8{ zig_exe, "test", "--color", @@ -1283,7 +1283,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var var test_args = std.ArrayList([]const u8).init(allocator); defer test_args.deinit(); - try test_args.appendSlice([_][]const u8{ + try test_args.appendSlice(&[_][]const u8{ zig_exe, "test", tmp_source_file_name, @@ -1345,7 +1345,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{}{}", code.name, obj_ext); const tmp_obj_file_name = try fs.path.join( allocator, - [_][]const u8{ tmp_dir_name, name_plus_obj_ext }, + &[_][]const u8{ tmp_dir_name, name_plus_obj_ext }, ); var build_args = std.ArrayList([]const u8).init(allocator); defer build_args.deinit(); @@ -1353,10 +1353,10 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var const name_plus_h_ext = try std.fmt.allocPrint(allocator, "{}.h", code.name); const output_h_file_name = try fs.path.join( allocator, - [_][]const u8{ tmp_dir_name, name_plus_h_ext }, + &[_][]const u8{ tmp_dir_name, name_plus_h_ext }, ); - try build_args.appendSlice([_][]const u8{ + try build_args.appendSlice(&[_][]const u8{ zig_exe, "build-obj", tmp_source_file_name, @@ -1395,7 +1395,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var } if (code.target_str) |triple| { - try build_args.appendSlice([_][]const u8{ "-target", triple }); + try build_args.appendSlice(&[_][]const u8{ "-target", triple }); try out.print(" -target {}", triple); } @@ -1442,7 +1442,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var var test_args = std.ArrayList([]const u8).init(allocator); defer test_args.deinit(); - try test_args.appendSlice([_][]const u8{ + try test_args.appendSlice(&[_][]const u8{ zig_exe, "build-lib", tmp_source_file_name, @@ -1466,7 +1466,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var }, } if (code.target_str) |triple| { - try test_args.appendSlice([_][]const u8{ "-target", triple }); + try test_args.appendSlice(&[_][]const u8{ "-target", triple }); try out.print(" -target {}", triple); } const result = exec(allocator, &env_map, test_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "test failed"); @@ -1507,7 +1507,7 @@ fn exec(allocator: *mem.Allocator, env_map: *std.BufMap, args: []const []const u } fn getBuiltinCode(allocator: *mem.Allocator, env_map: *std.BufMap, zig_exe: []const u8) ![]const u8 { - const result = try exec(allocator, env_map, [_][]const u8{ + const result = try exec(allocator, env_map, &[_][]const u8{ zig_exe, "builtin", }); diff --git a/doc/langref.html.in b/doc/langref.html.in index b742119af7..ab1f3e89f9 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -1518,7 +1518,7 @@ value == null{#endsyntax#} const array1 = [_]u32{1,2}; const array2 = [_]u32{3,4}; const together = array1 ++ array2; -mem.eql(u32, together, [_]u32{1,2,3,4}){#endsyntax#} +mem.eql(u32, together, &[_]u32{1,2,3,4}){#endsyntax#}
@@ -8948,7 +8948,7 @@ pub fn main() void { {#code_begin|test_err|unable to convert#} comptime { var bytes = [5]u8{ 1, 2, 3, 4, 5 }; - var slice = @bytesToSlice(u32, bytes); + var slice = @bytesToSlice(u32, bytes[0..]); } {#code_end#}
At runtime:
@@ -9760,7 +9760,7 @@ pub fn build(b: *Builder) void { const lib = b.addSharedLibrary("mathtest", "mathtest.zig", b.version(1, 0, 0)); const exe = b.addExecutable("test", null); - exe.addCSourceFile("test.c", [_][]const u8{"-std=c99"}); + exe.addCSourceFile("test.c", &[_][]const u8{"-std=c99"}); exe.linkLibrary(lib); exe.linkSystemLibrary("c"); @@ -9825,7 +9825,7 @@ pub fn build(b: *Builder) void { const obj = b.addObject("base64", "base64.zig"); const exe = b.addExecutable("test", null); - exe.addCSourceFile("test.c", [_][]const u8{"-std=c99"}); + exe.addCSourceFile("test.c", &[_][]const u8{"-std=c99"}); exe.addObject(obj); exe.linkSystemLibrary("c"); exe.install(); diff --git a/src/ir.cpp b/src/ir.cpp index 65991aa4d5..21211e8ac7 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -23646,6 +23646,7 @@ static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstru } if (target->value->type->id == ZigTypeIdPointer && + target->value->type->data.pointer.ptr_len == PtrLenSingle && target->value->type->data.pointer.child_type->id == ZigTypeIdArray) { known_len = target->value->type->data.pointer.child_type->data.array.len;