authorgravatar for josh@inv.alid.pwJosh Holland <josh@inv.alid.pw> 2020-11-06 18:54:08+00:00
committergravatar for josh@inv.alid.pwJosh Holland <josh@inv.alid.pw> 2020-11-07 11:15:44+00:00
logc25b157ddaede518d92ee2d87ad536a5b6b097de
tree1599c465bab670beb50b63c2a5b9d8f0411fbc9d
parentc9551652b01bf47a94c139846f22c5df85d07283

remove deprecated uses of ArrayList.span


29 files changed, 108 insertions(+), 108 deletions(-)

lib/std/array_list.zig+1-1
......@@ -1061,7 +1061,7 @@ test "std.ArrayList(u8) implements outStream" {
10611061 const y: i32 = 1234;
10621062 try buffer.outStream().print("x: {}\ny: {}\n", .{ x, y });
10631063
1064 testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.span());
1064 testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items);
10651065}
10661066
10671067test "std.ArrayList/ArrayListUnmanaged.shrink still sets length on error.OutOfMemory" {
lib/std/array_list_sentineled.zig+1-1
......@@ -147,7 +147,7 @@ pub fn ArrayListSentineled(comptime T: type, comptime sentinel: T) type {
147147
148148 pub fn replaceContents(self: *Self, m: []const T) !void {
149149 try self.resize(m.len);
150 mem.copy(T, self.list.span(), m);
150 mem.copy(T, self.list.items, m);
151151 }
152152
153153 /// Initializes an OutStream which will append to the list.
lib/std/build.zig+18-18
......@@ -386,7 +386,7 @@ pub const Builder = struct {
386386 }
387387 }
388388
389 for (wanted_steps.span()) |s| {
389 for (wanted_steps.items) |s| {
390390 try self.makeOneStep(s);
391391 }
392392 }
......@@ -403,7 +403,7 @@ pub const Builder = struct {
403403 const uninstall_tls = @fieldParentPtr(TopLevelStep, "step", uninstall_step);
404404 const self = @fieldParentPtr(Builder, "uninstall_tls", uninstall_tls);
405405
406 for (self.installed_files.span()) |installed_file| {
406 for (self.installed_files.items) |installed_file| {
407407 const full_path = self.getInstallPath(installed_file.dir, installed_file.path);
408408 if (self.verbose) {
409409 warn("rm {}\n", .{full_path});
......@@ -421,7 +421,7 @@ pub const Builder = struct {
421421 }
422422 s.loop_flag = true;
423423
424 for (s.dependencies.span()) |dep| {
424 for (s.dependencies.items) |dep| {
425425 self.makeOneStep(dep) catch |err| {
426426 if (err == error.DependencyLoopDetected) {
427427 warn(" {}\n", .{s.name});
......@@ -436,7 +436,7 @@ pub const Builder = struct {
436436 }
437437
438438 fn getTopLevelStepByName(self: *Builder, name: []const u8) !*Step {
439 for (self.top_level_steps.span()) |top_level_step| {
439 for (self.top_level_steps.items) |top_level_step| {
440440 if (mem.eql(u8, top_level_step.step.name, name)) {
441441 return &top_level_step.step;
442442 }
......@@ -550,7 +550,7 @@ pub const Builder = struct {
550550 .Scalar => |s| {
551551 return self.allocator.dupe([]const u8, &[_][]const u8{s}) catch unreachable;
552552 },
553 .List => |lst| return lst.span(),
553 .List => |lst| return lst.items,
554554 },
555555 }
556556 }
......@@ -951,7 +951,7 @@ pub const Builder = struct {
951951 pub fn findProgram(self: *Builder, names: []const []const u8, paths: []const []const u8) ![]const u8 {
952952 // TODO report error for ambiguous situations
953953 const exe_extension = @as(CrossTarget, .{}).exeFileExt();
954 for (self.search_prefixes.span()) |search_prefix| {
954 for (self.search_prefixes.items) |search_prefix| {
955955 for (names) |name| {
956956 if (fs.path.isAbsolute(name)) {
957957 return name;
......@@ -1096,7 +1096,7 @@ pub const Builder = struct {
10961096 .desc = tok_it.rest(),
10971097 });
10981098 }
1099 return list.span();
1099 return list.items;
11001100 }
11011101
11021102 fn getPkgConfigList(self: *Builder) ![]const PkgConfigPkg {
......@@ -1505,7 +1505,7 @@ pub const LibExeObjStep = struct {
15051505 if (isLibCLibrary(name)) {
15061506 return self.is_linking_libc;
15071507 }
1508 for (self.link_objects.span()) |link_object| {
1508 for (self.link_objects.items) |link_object| {
15091509 switch (link_object) {
15101510 LinkObject.SystemLib => |n| if (mem.eql(u8, n, name)) return true,
15111511 else => continue,
......@@ -1908,7 +1908,7 @@ pub const LibExeObjStep = struct {
19081908 self.include_dirs.append(IncludeDir{ .OtherStep = other }) catch unreachable;
19091909
19101910 // Inherit dependency on system libraries
1911 for (other.link_objects.span()) |link_object| {
1911 for (other.link_objects.items) |link_object| {
19121912 switch (link_object) {
19131913 .SystemLib => |name| self.linkSystemLibrary(name),
19141914 else => continue,
......@@ -1970,7 +1970,7 @@ pub const LibExeObjStep = struct {
19701970 if (self.root_src) |root_src| try zig_args.append(root_src.getPath(builder));
19711971
19721972 var prev_has_extra_flags = false;
1973 for (self.link_objects.span()) |link_object| {
1973 for (self.link_objects.items) |link_object| {
19741974 switch (link_object) {
19751975 .StaticPath => |static_path| {
19761976 try zig_args.append(builder.pathFromRoot(static_path));
......@@ -2040,7 +2040,7 @@ pub const LibExeObjStep = struct {
20402040 &[_][]const u8{ builder.cache_root, builder.fmt("{}_build_options.zig", .{self.name}) },
20412041 );
20422042 const path_from_root = builder.pathFromRoot(build_options_file);
2043 try fs.cwd().writeFile(path_from_root, self.build_options_contents.span());
2043 try fs.cwd().writeFile(path_from_root, self.build_options_contents.items);
20442044 try zig_args.append("--pkg-begin");
20452045 try zig_args.append("build_options");
20462046 try zig_args.append(path_from_root);
......@@ -2238,11 +2238,11 @@ pub const LibExeObjStep = struct {
22382238 },
22392239 }
22402240
2241 for (self.packages.span()) |pkg| {
2241 for (self.packages.items) |pkg| {
22422242 try self.makePackageCmd(pkg, &zig_args);
22432243 }
22442244
2245 for (self.include_dirs.span()) |include_dir| {
2245 for (self.include_dirs.items) |include_dir| {
22462246 switch (include_dir) {
22472247 .RawPath => |include_path| {
22482248 try zig_args.append("-I");
......@@ -2260,18 +2260,18 @@ pub const LibExeObjStep = struct {
22602260 }
22612261 }
22622262
2263 for (self.lib_paths.span()) |lib_path| {
2263 for (self.lib_paths.items) |lib_path| {
22642264 try zig_args.append("-L");
22652265 try zig_args.append(lib_path);
22662266 }
22672267
2268 for (self.c_macros.span()) |c_macro| {
2268 for (self.c_macros.items) |c_macro| {
22692269 try zig_args.append("-D");
22702270 try zig_args.append(c_macro);
22712271 }
22722272
22732273 if (self.target.isDarwin()) {
2274 for (self.framework_dirs.span()) |dir| {
2274 for (self.framework_dirs.items) |dir| {
22752275 try zig_args.append("-F");
22762276 try zig_args.append(dir);
22772277 }
......@@ -2331,11 +2331,11 @@ pub const LibExeObjStep = struct {
23312331 }
23322332
23332333 if (self.kind == Kind.Test) {
2334 try builder.spawnChild(zig_args.span());
2334 try builder.spawnChild(zig_args.items);
23352335 } else {
23362336 try zig_args.append("--enable-cache");
23372337
2338 const output_dir_nl = try builder.execFromStep(zig_args.span(), &self.step);
2338 const output_dir_nl = try builder.execFromStep(zig_args.items, &self.step);
23392339 const build_output_dir = mem.trimRight(u8, output_dir_nl, "\r\n");
23402340
23412341 if (self.output_dir) |output_dir| {
lib/std/build/emit_raw.zig+6-6
......@@ -79,7 +79,7 @@ const BinaryElfOutput = struct {
7979 newSegment.binaryOffset = 0;
8080 newSegment.firstSection = null;
8181
82 for (self.sections.span()) |section| {
82 for (self.sections.items) |section| {
8383 if (sectionWithinSegment(section, phdr)) {
8484 if (section.segment) |sectionSegment| {
8585 if (sectionSegment.elfOffset > newSegment.elfOffset) {
......@@ -99,7 +99,7 @@ const BinaryElfOutput = struct {
9999 }
100100 }
101101
102 sort.sort(*BinaryElfSegment, self.segments.span(), {}, segmentSortCompare);
102 sort.sort(*BinaryElfSegment, self.segments.items, {}, segmentSortCompare);
103103
104104 if (self.segments.items.len > 0) {
105105 const firstSegment = self.segments.items[0];
......@@ -112,19 +112,19 @@ const BinaryElfOutput = struct {
112112
113113 const basePhysicalAddress = firstSegment.physicalAddress;
114114
115 for (self.segments.span()) |segment| {
115 for (self.segments.items) |segment| {
116116 segment.binaryOffset = segment.physicalAddress - basePhysicalAddress;
117117 }
118118 }
119119 }
120120
121 for (self.sections.span()) |section| {
121 for (self.sections.items) |section| {
122122 if (section.segment) |segment| {
123123 section.binaryOffset = segment.binaryOffset + (section.elfOffset - segment.elfOffset);
124124 }
125125 }
126126
127 sort.sort(*BinaryElfSection, self.sections.span(), {}, sectionSortCompare);
127 sort.sort(*BinaryElfSection, self.sections.items, {}, sectionSortCompare);
128128
129129 return self;
130130 }
......@@ -172,7 +172,7 @@ fn emitRaw(allocator: *Allocator, elf_path: []const u8, raw_path: []const u8) !v
172172 var binary_elf_output = try BinaryElfOutput.parse(allocator, elf_file);
173173 defer binary_elf_output.deinit();
174174
175 for (binary_elf_output.sections.span()) |section| {
175 for (binary_elf_output.sections.items) |section| {
176176 try writeBinaryElfSection(elf_file, out_file, section);
177177 }
178178}
lib/std/build/run.zig+3-3
......@@ -159,7 +159,7 @@ pub const RunStep = struct {
159159 const cwd = if (self.cwd) |cwd| self.builder.pathFromRoot(cwd) else self.builder.build_root;
160160
161161 var argv_list = ArrayList([]const u8).init(self.builder.allocator);
162 for (self.argv.span()) |arg| {
162 for (self.argv.items) |arg| {
163163 switch (arg) {
164164 Arg.Bytes => |bytes| try argv_list.append(bytes),
165165 Arg.WriteFile => |file| {
......@@ -176,7 +176,7 @@ pub const RunStep = struct {
176176 }
177177 }
178178
179 const argv = argv_list.span();
179 const argv = argv_list.items;
180180
181181 const child = std.ChildProcess.init(argv, self.builder.allocator) catch unreachable;
182182 defer child.deinit();
......@@ -312,7 +312,7 @@ pub const RunStep = struct {
312312 }
313313
314314 fn addPathForDynLibs(self: *RunStep, artifact: *LibExeObjStep) void {
315 for (artifact.link_objects.span()) |link_object| {
315 for (artifact.link_objects.items) |link_object| {
316316 switch (link_object) {
317317 .OtherStep => |other| {
318318 if (other.target.isWindows() and other.isDynamicLibrary()) {
lib/std/build/translate_c.zig+1-1
......@@ -86,7 +86,7 @@ pub const TranslateCStep = struct {
8686
8787 try argv_list.append(self.source.getPath(self.builder));
8888
89 const output_path_nl = try self.builder.execFromStep(argv_list.span(), &self.step);
89 const output_path_nl = try self.builder.execFromStep(argv_list.items, &self.step);
9090 const output_path = mem.trimRight(u8, output_path_nl, "\r\n");
9191
9292 self.out_basename = fs.path.basename(output_path);
lib/std/build/write_file.zig+2-2
......@@ -64,7 +64,7 @@ pub const WriteFileStep = struct {
6464 // new random bytes when WriteFileStep implementation is modified
6565 // in a non-backwards-compatible way.
6666 hash.update("eagVR1dYXoE7ARDP");
67 for (self.files.span()) |file| {
67 for (self.files.items) |file| {
6868 hash.update(file.basename);
6969 hash.update(file.bytes);
7070 hash.update("|");
......@@ -85,7 +85,7 @@ pub const WriteFileStep = struct {
8585 };
8686 var dir = try fs.cwd().openDir(self.output_dir, .{});
8787 defer dir.close();
88 for (self.files.span()) |file| {
88 for (self.files.items) |file| {
8989 dir.writeFile(file.basename, file.bytes) catch |err| {
9090 warn("unable to write {} into {}: {}\n", .{
9191 file.basename,
lib/std/coff.zig+2-2
......@@ -216,7 +216,7 @@ pub const Coff = struct {
216216 blk: while (i < debug_dir_entry_count) : (i += 1) {
217217 const debug_dir_entry = try in.readStruct(DebugDirectoryEntry);
218218 if (debug_dir_entry.type == IMAGE_DEBUG_TYPE_CODEVIEW) {
219 for (self.sections.span()) |*section| {
219 for (self.sections.items) |*section| {
220220 const section_start = section.header.virtual_address;
221221 const section_size = section.header.misc.virtual_size;
222222 const rva = debug_dir_entry.address_of_raw_data;
......@@ -282,7 +282,7 @@ pub const Coff = struct {
282282 }
283283
284284 pub fn getSection(self: *Coff, comptime name: []const u8) ?*Section {
285 for (self.sections.span()) |*sec| {
285 for (self.sections.items) |*sec| {
286286 if (mem.eql(u8, sec.header.name[0..name.len], name)) {
287287 return sec;
288288 }
lib/std/debug.zig+1-1
......@@ -1509,7 +1509,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) {
15091509 const mod_index = for (self.sect_contribs) |sect_contrib| {
15101510 if (sect_contrib.Section > self.coff.sections.items.len) continue;
15111511 // Remember that SectionContribEntry.Section is 1-based.
1512 coff_section = &self.coff.sections.span()[sect_contrib.Section - 1];
1512 coff_section = &self.coff.sections.items[sect_contrib.Section - 1];
15131513
15141514 const vaddr_start = coff_section.header.virtual_address + sect_contrib.Offset;
15151515 const vaddr_end = vaddr_start + sect_contrib.Size;
lib/std/dwarf.zig+7-7
......@@ -87,7 +87,7 @@ const Die = struct {
8787 };
8888
8989 fn getAttr(self: *const Die, id: u64) ?*const FormValue {
90 for (self.attrs.span()) |*attr| {
90 for (self.attrs.items) |*attr| {
9191 if (attr.id == id) return &attr.value;
9292 }
9393 return null;
......@@ -371,7 +371,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: anytype, form_id: u64, e
371371}
372372
373373fn getAbbrevTableEntry(abbrev_table: *const AbbrevTable, abbrev_code: u64) ?*const AbbrevTableEntry {
374 for (abbrev_table.span()) |*table_entry| {
374 for (abbrev_table.items) |*table_entry| {
375375 if (table_entry.abbrev_code == abbrev_code) return table_entry;
376376 }
377377 return null;
......@@ -395,7 +395,7 @@ pub const DwarfInfo = struct {
395395 }
396396
397397 pub fn getSymbolName(di: *DwarfInfo, address: u64) ?[]const u8 {
398 for (di.func_list.span()) |*func| {
398 for (di.func_list.items) |*func| {
399399 if (func.pc_range) |range| {
400400 if (address >= range.start and address < range.end) {
401401 return func.name;
......@@ -584,7 +584,7 @@ pub const DwarfInfo = struct {
584584 }
585585
586586 pub fn findCompileUnit(di: *DwarfInfo, target_address: u64) !*const CompileUnit {
587 for (di.compile_unit_list.span()) |*compile_unit| {
587 for (di.compile_unit_list.items) |*compile_unit| {
588588 if (compile_unit.pc_range) |range| {
589589 if (target_address >= range.start and target_address < range.end) return compile_unit;
590590 }
......@@ -632,7 +632,7 @@ pub const DwarfInfo = struct {
632632 /// Gets an already existing AbbrevTable given the abbrev_offset, or if not found,
633633 /// seeks in the stream and parses it.
634634 fn getAbbrevTable(di: *DwarfInfo, abbrev_offset: u64) !*const AbbrevTable {
635 for (di.abbrev_table_list.span()) |*header| {
635 for (di.abbrev_table_list.items) |*header| {
636636 if (header.offset == abbrev_offset) {
637637 return &header.table;
638638 }
......@@ -686,7 +686,7 @@ pub const DwarfInfo = struct {
686686 .attrs = ArrayList(Die.Attr).init(di.allocator()),
687687 };
688688 try result.attrs.resize(table_entry.attrs.items.len);
689 for (table_entry.attrs.span()) |attr, i| {
689 for (table_entry.attrs.items) |attr, i| {
690690 result.attrs.items[i] = Die.Attr{
691691 .id = attr.attr_id,
692692 .value = try parseFormValue(di.allocator(), in_stream, attr.form_id, di.endian, is_64),
......@@ -753,7 +753,7 @@ pub const DwarfInfo = struct {
753753 }
754754
755755 var file_entries = ArrayList(FileEntry).init(di.allocator());
756 var prog = LineNumberProgram.init(default_is_stmt, include_directories.span(), &file_entries, target_address);
756 var prog = LineNumberProgram.init(default_is_stmt, include_directories.items, &file_entries, target_address);
757757
758758 while (true) {
759759 const file_name = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize));
lib/std/fs.zig+3-3
......@@ -2078,7 +2078,7 @@ pub const Walker = struct {
20782078 while (true) {
20792079 if (self.stack.items.len == 0) return null;
20802080 // `top` becomes invalid after appending to `self.stack`.
2081 const top = &self.stack.span()[self.stack.items.len - 1];
2081 const top = &self.stack.items[self.stack.items.len - 1];
20822082 const dirname_len = top.dirname_len;
20832083 if (try top.dir_it.next()) |base| {
20842084 self.name_buffer.shrink(dirname_len);
......@@ -2099,8 +2099,8 @@ pub const Walker = struct {
20992099 }
21002100 return Entry{
21012101 .dir = top.dir_it.dir,
2102 .basename = self.name_buffer.span()[dirname_len + 1 ..],
2103 .path = self.name_buffer.span(),
2102 .basename = self.name_buffer.items[dirname_len + 1 ..],
2103 .path = self.name_buffer.items,
21042104 .kind = base.kind,
21052105 };
21062106 } else {
lib/std/io/reader.zig+1-1
......@@ -62,7 +62,7 @@ pub fn Reader(
6262 var start_index: usize = original_len;
6363 while (true) {
6464 array_list.expandToCapacity();
65 const dest_slice = array_list.span()[start_index..];
65 const dest_slice = array_list.items[start_index..];
6666 const bytes_read = try self.readAll(dest_slice);
6767 start_index += bytes_read;
6868
lib/std/json.zig+2-2
......@@ -1249,7 +1249,7 @@ pub const Value = union(enum) {
12491249 .Integer => |inner| try stringify(inner, options, out_stream),
12501250 .Float => |inner| try stringify(inner, options, out_stream),
12511251 .String => |inner| try stringify(inner, options, out_stream),
1252 .Array => |inner| try stringify(inner.span(), options, out_stream),
1252 .Array => |inner| try stringify(inner.items, options, out_stream),
12531253 .Object => |inner| {
12541254 try out_stream.writeByte('{');
12551255 var field_output = false;
......@@ -2036,7 +2036,7 @@ pub const Parser = struct {
20362036 }
20372037
20382038 fn pushToParent(p: *Parser, value: *const Value) !void {
2039 switch (p.stack.span()[p.stack.items.len - 1]) {
2039 switch (p.stack.items[p.stack.items.len - 1]) {
20402040 // Object Parent -> [ ..., object, <key>, value ]
20412041 Value.String => |key| {
20422042 _ = p.stack.pop();
lib/std/net.zig+6-6
......@@ -796,7 +796,7 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !*
796796 result.canon_name = canon.toOwnedSlice();
797797 }
798798
799 for (lookup_addrs.span()) |lookup_addr, i| {
799 for (lookup_addrs.items) |lookup_addr, i| {
800800 result.addrs[i] = lookup_addr.addr;
801801 assert(result.addrs[i].getPort() == port);
802802 }
......@@ -849,7 +849,7 @@ fn linuxLookupName(
849849 // No further processing is needed if there are fewer than 2
850850 // results or if there are only IPv4 results.
851851 if (addrs.items.len == 1 or family == os.AF_INET) return;
852 const all_ip4 = for (addrs.span()) |addr| {
852 const all_ip4 = for (addrs.items) |addr| {
853853 if (addr.addr.any.family != os.AF_INET) break false;
854854 } else true;
855855 if (all_ip4) return;
......@@ -861,7 +861,7 @@ fn linuxLookupName(
861861 // So far the label/precedence table cannot be customized.
862862 // This implementation is ported from musl libc.
863863 // A more idiomatic "ziggy" implementation would be welcome.
864 for (addrs.span()) |*addr, i| {
864 for (addrs.items) |*addr, i| {
865865 var key: i32 = 0;
866866 var sa6: os.sockaddr_in6 = undefined;
867867 @memset(@ptrCast([*]u8, &sa6), 0, @sizeOf(os.sockaddr_in6));
......@@ -926,7 +926,7 @@ fn linuxLookupName(
926926 key |= (MAXADDRS - @intCast(i32, i)) << DAS_ORDER_SHIFT;
927927 addr.sortkey = key;
928928 }
929 std.sort.sort(LookupAddr, addrs.span(), {}, addrCmpLessThan);
929 std.sort.sort(LookupAddr, addrs.items, {}, addrCmpLessThan);
930930}
931931
932932const Policy = struct {
......@@ -1361,9 +1361,9 @@ fn resMSendRc(
13611361 defer ns_list.deinit();
13621362
13631363 try ns_list.resize(rc.ns.items.len);
1364 const ns = ns_list.span();
1364 const ns = ns_list.items;
13651365
1366 for (rc.ns.span()) |iplit, i| {
1366 for (rc.ns.items) |iplit, i| {
13671367 ns[i] = iplit.addr;
13681368 assert(ns[i].getPort() == 53);
13691369 if (iplit.addr.any.family != os.AF_INET) {
lib/std/pdb.zig+1-1
......@@ -654,7 +654,7 @@ const MsfStream = struct {
654654 while (true) {
655655 const byte = try self.reader().readByte();
656656 if (byte == 0) {
657 return list.span();
657 return list.items;
658658 }
659659 try list.append(byte);
660660 }
lib/std/process.zig+2-2
......@@ -519,8 +519,8 @@ pub fn argsAlloc(allocator: *mem.Allocator) ![][:0]u8 {
519519 try slice_list.append(arg.len);
520520 }
521521
522 const contents_slice = contents.span();
523 const slice_sizes = slice_list.span();
522 const contents_slice = contents.items;
523 const slice_sizes = slice_list.items;
524524 const contents_size_bytes = try math.add(usize, contents_slice.len, slice_sizes.len);
525525 const slice_list_bytes = try math.mul(usize, @sizeOf([]u8), slice_sizes.len);
526526 const total_bytes = try math.add(usize, slice_list_bytes, contents_size_bytes);
lib/std/special/build_runner.zig+3-3
......@@ -130,7 +130,7 @@ pub fn main() !void {
130130 if (builder.validateUserInputDidItFail())
131131 return usageAndErr(builder, true, stderr_stream);
132132
133 builder.make(targets.span()) catch |err| {
133 builder.make(targets.items) catch |err| {
134134 switch (err) {
135135 error.InvalidStepName => {
136136 return usageAndErr(builder, true, stderr_stream);
......@@ -165,7 +165,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
165165 , .{builder.zig_exe});
166166
167167 const allocator = builder.allocator;
168 for (builder.top_level_steps.span()) |top_level_step| {
168 for (builder.top_level_steps.items) |top_level_step| {
169169 const name = if (&top_level_step.step == builder.default_step)
170170 try fmt.allocPrint(allocator, "{} (default)", .{top_level_step.step.name})
171171 else
......@@ -189,7 +189,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
189189 if (builder.available_options_list.items.len == 0) {
190190 try out_stream.print(" (none)\n", .{});
191191 } else {
192 for (builder.available_options_list.span()) |option| {
192 for (builder.available_options_list.items) |option| {
193193 const name = try fmt.allocPrint(allocator, " -D{}=[{}]", .{
194194 option.name,
195195 Builder.typeIdName(option.type_id),
lib/std/zig/system.zig+1-1
......@@ -128,7 +128,7 @@ pub const NativePaths = struct {
128128 }
129129
130130 fn deinitArray(array: *ArrayList([:0]u8)) void {
131 for (array.span()) |item| {
131 for (array.items) |item| {
132132 array.allocator.free(item);
133133 }
134134 array.deinit();
src/libc_installation.zig+3-3
......@@ -342,7 +342,7 @@ pub const LibCInstallation = struct {
342342 result_buf.shrink(0);
343343 try result_buf.outStream().print("{}\\Include\\{}\\ucrt", .{ search.path, search.version });
344344
345 var dir = fs.cwd().openDir(result_buf.span(), .{}) catch |err| switch (err) {
345 var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) {
346346 error.FileNotFound,
347347 error.NotDir,
348348 error.NoDevice,
......@@ -388,7 +388,7 @@ pub const LibCInstallation = struct {
388388 result_buf.shrink(0);
389389 try result_buf.outStream().print("{}\\Lib\\{}\\ucrt\\{}", .{ search.path, search.version, arch_sub_dir });
390390
391 var dir = fs.cwd().openDir(result_buf.span(), .{}) catch |err| switch (err) {
391 var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) {
392392 error.FileNotFound,
393393 error.NotDir,
394394 error.NoDevice,
......@@ -443,7 +443,7 @@ pub const LibCInstallation = struct {
443443 const stream = result_buf.outStream();
444444 try stream.print("{}\\Lib\\{}\\um\\{}", .{ search.path, search.version, arch_sub_dir });
445445
446 var dir = fs.cwd().openDir(result_buf.span(), .{}) catch |err| switch (err) {
446 var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) {
447447 error.FileNotFound,
448448 error.NotDir,
449449 error.NoDevice,
src/main.zig+3-3
......@@ -2501,7 +2501,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {
25012501 defer fmt.seen.deinit();
25022502 defer fmt.out_buffer.deinit();
25032503
2504 for (input_files.span()) |file_path| {
2504 for (input_files.items) |file_path| {
25052505 // Get the real path here to avoid Windows failing on relative file paths with . or .. in them.
25062506 const real_path = fs.realpathAlloc(gpa, file_path) catch |err| {
25072507 fatal("unable to open '{}': {}", .{ file_path, err });
......@@ -2681,7 +2681,7 @@ fn printErrMsgToFile(
26812681 defer text_buf.deinit();
26822682 const out_stream = text_buf.outStream();
26832683 try parse_error.render(tree.token_ids, out_stream);
2684 const text = text_buf.span();
2684 const text = text_buf.items;
26852685
26862686 const stream = file.outStream();
26872687 try stream.print("{}:{}:{}: error: {}\n", .{ path, start_loc.line + 1, start_loc.column + 1, text });
......@@ -2830,7 +2830,7 @@ pub const ClangArgIterator = struct {
28302830 defer resp_arg_list.deinit();
28312831 {
28322832 errdefer {
2833 for (resp_arg_list.span()) |item| {
2833 for (resp_arg_list.items) |item| {
28342834 allocator.free(mem.span(item));
28352835 }
28362836 }
src/translate_c.zig+1-1
......@@ -6566,7 +6566,7 @@ fn parseCUnaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!*ast.Nod
65666566
65676567fn tokenSlice(c: *Context, token: ast.TokenIndex) []u8 {
65686568 const tok = c.token_locs.items[token];
6569 const slice = c.source_buffer.span()[tok.start..tok.end];
6569 const slice = c.source_buffer.items[tok.start..tok.end];
65706570 return if (mem.startsWith(u8, slice, "@\""))
65716571 slice[2 .. slice.len - 1]
65726572 else
test/src/compare_output.zig+4-4
......@@ -91,7 +91,7 @@ pub const CompareOutputContext = struct {
9191 const b = self.b;
9292
9393 const write_src = b.addWriteFiles();
94 for (case.sources.span()) |src_file| {
94 for (case.sources.items) |src_file| {
9595 write_src.add(src_file.filename, src_file.source);
9696 }
9797
......@@ -105,7 +105,7 @@ pub const CompareOutputContext = struct {
105105 }
106106
107107 const exe = b.addExecutable("test", null);
108 exe.addAssemblyFileFromWriteFileStep(write_src, case.sources.span()[0].filename);
108 exe.addAssemblyFileFromWriteFileStep(write_src, case.sources.items[0].filename);
109109
110110 const run = exe.run();
111111 run.addArgs(case.cli_args);
......@@ -125,7 +125,7 @@ pub const CompareOutputContext = struct {
125125 if (mem.indexOf(u8, annotated_case_name, filter) == null) continue;
126126 }
127127
128 const basename = case.sources.span()[0].filename;
128 const basename = case.sources.items[0].filename;
129129 const exe = b.addExecutableFromWriteFileStep("test", write_src, basename);
130130 exe.setBuildMode(mode);
131131 if (case.link_libc) {
......@@ -146,7 +146,7 @@ pub const CompareOutputContext = struct {
146146 if (mem.indexOf(u8, annotated_case_name, filter) == null) return;
147147 }
148148
149 const basename = case.sources.span()[0].filename;
149 const basename = case.sources.items[0].filename;
150150 const exe = b.addExecutableFromWriteFileStep("test", write_src, basename);
151151 if (case.link_libc) {
152152 exe.linkSystemLibrary("c");
test/src/run_translated_c.zig+2-2
......@@ -82,13 +82,13 @@ pub const RunTranslatedCContext = struct {
8282 }
8383
8484 const write_src = b.addWriteFiles();
85 for (case.sources.span()) |src_file| {
85 for (case.sources.items) |src_file| {
8686 write_src.add(src_file.filename, src_file.source);
8787 }
8888 const translate_c = b.addTranslateC(.{
8989 .write_file = .{
9090 .step = write_src,
91 .basename = case.sources.span()[0].filename,
91 .basename = case.sources.items[0].filename,
9292 },
9393 });
9494 translate_c.step.name = b.fmt("{} translate-c", .{annotated_case_name});
test/src/translate_c.zig+3-3
......@@ -105,20 +105,20 @@ pub const TranslateCContext = struct {
105105 }
106106
107107 const write_src = b.addWriteFiles();
108 for (case.sources.span()) |src_file| {
108 for (case.sources.items) |src_file| {
109109 write_src.add(src_file.filename, src_file.source);
110110 }
111111
112112 const translate_c = b.addTranslateC(.{
113113 .write_file = .{
114114 .step = write_src,
115 .basename = case.sources.span()[0].filename,
115 .basename = case.sources.items[0].filename,
116116 },
117117 });
118118 translate_c.step.name = annotated_case_name;
119119 translate_c.setTarget(case.target);
120120
121 const check_file = translate_c.addCheckFile(case.expected_lines.span());
121 const check_file = translate_c.addCheckFile(case.expected_lines.items);
122122
123123 self.step.dependOn(&check_file.step);
124124 }
test/standalone/brace_expansion/main.zig+5-5
......@@ -131,7 +131,7 @@ fn expandString(input: []const u8, output: *ArrayListSentineled(u8, 0)) !void {
131131 try expandNode(root, &result_list);
132132
133133 try output.resize(0);
134 for (result_list.span()) |buf, i| {
134 for (result_list.items) |buf, i| {
135135 if (i != 0) {
136136 try output.append(' ');
137137 }
......@@ -157,8 +157,8 @@ fn expandNode(node: Node, output: *ArrayList(ArrayListSentineled(u8, 0))) Expand
157157 var child_list_b = ArrayList(ArrayListSentineled(u8, 0)).init(global_allocator);
158158 try expandNode(b_node, &child_list_b);
159159
160 for (child_list_a.span()) |buf_a| {
161 for (child_list_b.span()) |buf_b| {
160 for (child_list_a.items) |buf_a| {
161 for (child_list_b.items) |buf_b| {
162162 var combined_buf = try ArrayListSentineled(u8, 0).initFromBuffer(buf_a);
163163 try combined_buf.appendSlice(buf_b.span());
164164 try output.append(combined_buf);
......@@ -166,11 +166,11 @@ fn expandNode(node: Node, output: *ArrayList(ArrayListSentineled(u8, 0))) Expand
166166 }
167167 },
168168 Node.List => |list| {
169 for (list.span()) |child_node| {
169 for (list.items) |child_node| {
170170 var child_list = ArrayList(ArrayListSentineled(u8, 0)).init(global_allocator);
171171 try expandNode(child_node, &child_list);
172172
173 for (child_list.span()) |buf| {
173 for (child_list.items) |buf| {
174174 try output.append(buf);
175175 }
176176 }
tools/merge_anal_dumps.zig+12-12
......@@ -183,13 +183,13 @@ const Dump = struct {
183183 try mergeSameStrings(&self.zig_version, zig_version);
184184 try mergeSameStrings(&self.root_name, root_name);
185185
186 for (params.get("builds").?.value.Array.span()) |json_build| {
186 for (params.get("builds").?.value.Array.items) |json_build| {
187187 const target = json_build.Object.get("target").?.value.String;
188188 try self.targets.append(target);
189189 }
190190
191191 // Merge files. If the string matches, it's the same file.
192 const other_files = root.Object.get("files").?.value.Array.span();
192 const other_files = root.Object.get("files").?.value.Array.items;
193193 var other_file_to_mine = std.AutoHashMap(usize, usize).init(self.a());
194194 for (other_files) |other_file, i| {
195195 const gop = try self.file_map.getOrPut(other_file.String);
......@@ -201,7 +201,7 @@ const Dump = struct {
201201 }
202202
203203 // Merge AST nodes. If the file id, line, and column all match, it's the same AST node.
204 const other_ast_nodes = root.Object.get("astNodes").?.value.Array.span();
204 const other_ast_nodes = root.Object.get("astNodes").?.value.Array.items;
205205 var other_ast_node_to_mine = std.AutoHashMap(usize, usize).init(self.a());
206206 for (other_ast_nodes) |other_ast_node_json, i| {
207207 const other_file_id = jsonObjInt(other_ast_node_json, "file");
......@@ -221,9 +221,9 @@ const Dump = struct {
221221 // convert fields lists
222222 for (other_ast_nodes) |other_ast_node_json, i| {
223223 const my_node_index = other_ast_node_to_mine.get(i).?.value;
224 const my_node = &self.node_list.span()[my_node_index];
224 const my_node = &self.node_list.items[my_node_index];
225225 if (other_ast_node_json.Object.get("fields")) |fields_json_kv| {
226 const other_fields = fields_json_kv.value.Array.span();
226 const other_fields = fields_json_kv.value.Array.items;
227227 my_node.fields = try self.a().alloc(usize, other_fields.len);
228228 for (other_fields) |other_field_index, field_i| {
229229 const other_index = @intCast(usize, other_field_index.Integer);
......@@ -233,7 +233,7 @@ const Dump = struct {
233233 }
234234
235235 // Merge errors. If the AST Node matches, it's the same error value.
236 const other_errors = root.Object.get("errors").?.value.Array.span();
236 const other_errors = root.Object.get("errors").?.value.Array.items;
237237 var other_error_to_mine = std.AutoHashMap(usize, usize).init(self.a());
238238 for (other_errors) |other_error_json, i| {
239239 const other_src_id = jsonObjInt(other_error_json, "src");
......@@ -253,7 +253,7 @@ const Dump = struct {
253253 // First we identify all the simple types and merge those.
254254 // Example: void, type, noreturn
255255 // We can also do integers and floats.
256 const other_types = root.Object.get("types").?.value.Array.span();
256 const other_types = root.Object.get("types").?.value.Array.items;
257257 var other_types_to_mine = std.AutoHashMap(usize, usize).init(self.a());
258258 for (other_types) |other_type_json, i| {
259259 const type_kind = jsonObjInt(other_type_json, "kind");
......@@ -336,7 +336,7 @@ const Dump = struct {
336336
337337 try jw.objectField("builds");
338338 try jw.beginArray();
339 for (self.targets.span()) |target| {
339 for (self.targets.items) |target| {
340340 try jw.arrayElem();
341341 try jw.beginObject();
342342 try jw.objectField("target");
......@@ -349,7 +349,7 @@ const Dump = struct {
349349
350350 try jw.objectField("types");
351351 try jw.beginArray();
352 for (self.type_list.span()) |t| {
352 for (self.type_list.items) |t| {
353353 try jw.arrayElem();
354354 try jw.beginObject();
355355
......@@ -379,7 +379,7 @@ const Dump = struct {
379379
380380 try jw.objectField("errors");
381381 try jw.beginArray();
382 for (self.error_list.span()) |zig_error| {
382 for (self.error_list.items) |zig_error| {
383383 try jw.arrayElem();
384384 try jw.beginObject();
385385
......@@ -395,7 +395,7 @@ const Dump = struct {
395395
396396 try jw.objectField("astNodes");
397397 try jw.beginArray();
398 for (self.node_list.span()) |node| {
398 for (self.node_list.items) |node| {
399399 try jw.arrayElem();
400400 try jw.beginObject();
401401
......@@ -425,7 +425,7 @@ const Dump = struct {
425425
426426 try jw.objectField("files");
427427 try jw.beginArray();
428 for (self.file_list.span()) |file| {
428 for (self.file_list.items) |file| {
429429 try jw.arrayElem();
430430 try jw.emitString(file);
431431 }
tools/process_headers.zig+2-2
......@@ -325,7 +325,7 @@ pub fn main() !void {
325325 },
326326 .os = .linux,
327327 };
328 search: for (search_paths.span()) |search_path| {
328 search: for (search_paths.items) |search_path| {
329329 var sub_path: []const []const u8 = undefined;
330330 switch (vendor) {
331331 .musl => {
......@@ -416,7 +416,7 @@ pub fn main() !void {
416416 try contents_list.append(contents);
417417 }
418418 }
419 std.sort.sort(*Contents, contents_list.span(), {}, Contents.hitCountLessThan);
419 std.sort.sort(*Contents, contents_list.items, {}, Contents.hitCountLessThan);
420420 const best_contents = contents_list.popOrNull().?;
421421 if (best_contents.hit_count > 1) {
422422 // worth it to make it generic
tools/update_clang_options.zig+5-5
......@@ -374,7 +374,7 @@ pub fn main() anyerror!void {
374374 }
375375 // Some options have multiple matches. As an example, "-Wl,foo" matches both
376376 // "W" and "Wl,". So we sort this list in order of descending priority.
377 std.sort.sort(*json.ObjectMap, all_objects.span(), {}, objectLessThan);
377 std.sort.sort(*json.ObjectMap, all_objects.items, {}, objectLessThan);
378378
379379 var stdout_bos = std.io.bufferedOutStream(std.io.getStdOut().outStream());
380380 const stdout = stdout_bos.outStream();
......@@ -386,12 +386,12 @@ pub fn main() anyerror!void {
386386 \\
387387 );
388388
389 for (all_objects.span()) |obj| {
389 for (all_objects.items) |obj| {
390390 const name = obj.get("Name").?.String;
391391 var pd1 = false;
392392 var pd2 = false;
393393 var pslash = false;
394 for (obj.get("Prefixes").?.Array.span()) |prefix_json| {
394 for (obj.get("Prefixes").?.Array.items) |prefix_json| {
395395 const prefix = prefix_json.String;
396396 if (std.mem.eql(u8, prefix, "-")) {
397397 pd1 = true;
......@@ -502,7 +502,7 @@ const Syntax = union(enum) {
502502
503503fn objSyntax(obj: *json.ObjectMap) Syntax {
504504 const num_args = @intCast(u8, obj.get("NumArgs").?.Integer);
505 for (obj.get("!superclasses").?.Array.span()) |superclass_json| {
505 for (obj.get("!superclasses").?.Array.items) |superclass_json| {
506506 const superclass = superclass_json.String;
507507 if (std.mem.eql(u8, superclass, "Joined")) {
508508 return .joined;
......@@ -548,7 +548,7 @@ fn objSyntax(obj: *json.ObjectMap) Syntax {
548548 }
549549 const key = obj.get("!name").?.String;
550550 std.debug.warn("{} (key {}) has unrecognized superclasses:\n", .{ name, key });
551 for (obj.get("!superclasses").?.Array.span()) |superclass_json| {
551 for (obj.get("!superclasses").?.Array.items) |superclass_json| {
552552 std.debug.warn(" {}\n", .{superclass_json.String});
553553 }
554554 std.process.exit(1);
tools/update_glibc.zig+7-7
......@@ -225,15 +225,15 @@ pub fn main() !void {
225225 var list = std.ArrayList([]const u8).init(allocator);
226226 var it = global_fn_set.iterator();
227227 while (it.next()) |entry| try list.append(entry.key);
228 std.sort.sort([]const u8, list.span(), {}, strCmpLessThan);
229 break :blk list.span();
228 std.sort.sort([]const u8, list.items, {}, strCmpLessThan);
229 break :blk list.items;
230230 };
231231 const global_ver_list = blk: {
232232 var list = std.ArrayList([]const u8).init(allocator);
233233 var it = global_ver_set.iterator();
234234 while (it.next()) |entry| try list.append(entry.key);
235 std.sort.sort([]const u8, list.span(), {}, versionLessThan);
236 break :blk list.span();
235 std.sort.sort([]const u8, list.items, {}, versionLessThan);
236 break :blk list.items;
237237 };
238238 {
239239 const vers_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "vers.txt" });
......@@ -266,13 +266,13 @@ pub fn main() !void {
266266 for (abi_lists) |*abi_list, abi_index| {
267267 const entry = target_functions.getEntry(@ptrToInt(abi_list)).?;
268268 const fn_vers_list = &entry.value.fn_vers_list;
269 for (entry.value.list.span()) |*ver_fn| {
269 for (entry.value.list.items) |*ver_fn| {
270270 const gop = try fn_vers_list.getOrPut(ver_fn.name);
271271 if (!gop.found_existing) {
272272 gop.entry.value = std.ArrayList(usize).init(allocator);
273273 }
274274 const ver_index = global_ver_set.getEntry(ver_fn.ver).?.value;
275 if (std.mem.indexOfScalar(usize, gop.entry.value.span(), ver_index) == null) {
275 if (std.mem.indexOfScalar(usize, gop.entry.value.items, ver_index) == null) {
276276 try gop.entry.value.append(ver_index);
277277 }
278278 }
......@@ -299,7 +299,7 @@ pub fn main() !void {
299299 try abilist_txt.writeByte('\n');
300300 continue;
301301 };
302 for (entry.value.span()) |ver_index, it_i| {
302 for (entry.value.items) |ver_index, it_i| {
303303 if (it_i != 0) try abilist_txt.writeByte(' ');
304304 try abilist_txt.print("{d}", .{ver_index});
305305 }