authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-11-18 13:14:48+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-11-18 13:14:48+02:00
log6d5b76a75d204ac2ce9fb2e03744d9733169dbe3
tree7fbdbc258851b0ee8e8635373d6b81b12168af68
parent66d6930b5c023deb65ea23eb0c4c5029b50b40a3
parenta1ec5448c77bee8d91c7e33d16416406b22fa159
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #7005 from jshholland/deprecate-span

Remove ArrayList.span

29 files changed, 109 insertions(+), 115 deletions(-)

lib/std/array_list.zig+2-8
...@@ -59,13 +59,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {...@@ -59,13 +59,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
59 self.allocator.free(self.allocatedSlice());59 self.allocator.free(self.allocatedSlice());
60 }60 }
6161
62 /// Deprecated: use `items` field directly.62 pub const span = @compileError("deprecated: use `items` field directly");
63 /// Return contents as a slice. Only valid while the list
64 /// doesn't change size.
65 pub fn span(self: anytype) @TypeOf(self.items) {
66 return self.items;
67 }
68
69 pub const toSlice = @compileError("deprecated: use `items` field directly");63 pub const toSlice = @compileError("deprecated: use `items` field directly");
70 pub const toSliceConst = @compileError("deprecated: use `items` field directly");64 pub const toSliceConst = @compileError("deprecated: use `items` field directly");
71 pub const at = @compileError("deprecated: use `list.items[i]`");65 pub const at = @compileError("deprecated: use `list.items[i]`");
...@@ -1061,7 +1055,7 @@ test "std.ArrayList(u8) implements outStream" {...@@ -1061,7 +1055,7 @@ test "std.ArrayList(u8) implements outStream" {
1061 const y: i32 = 1234;1055 const y: i32 = 1234;
1062 try buffer.outStream().print("x: {}\ny: {}\n", .{ x, y });1056 try buffer.outStream().print("x: {}\ny: {}\n", .{ x, y });
10631057
1064 testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.span());1058 testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items);
1065}1059}
10661060
1067test "std.ArrayList/ArrayListUnmanaged.shrink still sets length on error.OutOfMemory" {1061test "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 {...@@ -147,7 +147,7 @@ pub fn ArrayListSentineled(comptime T: type, comptime sentinel: T) type {
147147
148 pub fn replaceContents(self: *Self, m: []const T) !void {148 pub fn replaceContents(self: *Self, m: []const T) !void {
149 try self.resize(m.len);149 try self.resize(m.len);
150 mem.copy(T, self.list.span(), m);150 mem.copy(T, self.list.items, m);
151 }151 }
152152
153 /// Initializes an OutStream which will append to the list.153 /// Initializes an OutStream which will append to the list.
lib/std/build.zig+18-18
...@@ -386,7 +386,7 @@ pub const Builder = struct {...@@ -386,7 +386,7 @@ pub const Builder = struct {
386 }386 }
387 }387 }
388388
389 for (wanted_steps.span()) |s| {389 for (wanted_steps.items) |s| {
390 try self.makeOneStep(s);390 try self.makeOneStep(s);
391 }391 }
392 }392 }
...@@ -403,7 +403,7 @@ pub const Builder = struct {...@@ -403,7 +403,7 @@ pub const Builder = struct {
403 const uninstall_tls = @fieldParentPtr(TopLevelStep, "step", uninstall_step);403 const uninstall_tls = @fieldParentPtr(TopLevelStep, "step", uninstall_step);
404 const self = @fieldParentPtr(Builder, "uninstall_tls", uninstall_tls);404 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| {
407 const full_path = self.getInstallPath(installed_file.dir, installed_file.path);407 const full_path = self.getInstallPath(installed_file.dir, installed_file.path);
408 if (self.verbose) {408 if (self.verbose) {
409 warn("rm {}\n", .{full_path});409 warn("rm {}\n", .{full_path});
...@@ -421,7 +421,7 @@ pub const Builder = struct {...@@ -421,7 +421,7 @@ pub const Builder = struct {
421 }421 }
422 s.loop_flag = true;422 s.loop_flag = true;
423423
424 for (s.dependencies.span()) |dep| {424 for (s.dependencies.items) |dep| {
425 self.makeOneStep(dep) catch |err| {425 self.makeOneStep(dep) catch |err| {
426 if (err == error.DependencyLoopDetected) {426 if (err == error.DependencyLoopDetected) {
427 warn(" {}\n", .{s.name});427 warn(" {}\n", .{s.name});
...@@ -436,7 +436,7 @@ pub const Builder = struct {...@@ -436,7 +436,7 @@ pub const Builder = struct {
436 }436 }
437437
438 fn getTopLevelStepByName(self: *Builder, name: []const u8) !*Step {438 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| {
440 if (mem.eql(u8, top_level_step.step.name, name)) {440 if (mem.eql(u8, top_level_step.step.name, name)) {
441 return &top_level_step.step;441 return &top_level_step.step;
442 }442 }
...@@ -550,7 +550,7 @@ pub const Builder = struct {...@@ -550,7 +550,7 @@ pub const Builder = struct {
550 .Scalar => |s| {550 .Scalar => |s| {
551 return self.allocator.dupe([]const u8, &[_][]const u8{s}) catch unreachable;551 return self.allocator.dupe([]const u8, &[_][]const u8{s}) catch unreachable;
552 },552 },
553 .List => |lst| return lst.span(),553 .List => |lst| return lst.items,
554 },554 },
555 }555 }
556 }556 }
...@@ -951,7 +951,7 @@ pub const Builder = struct {...@@ -951,7 +951,7 @@ pub const Builder = struct {
951 pub fn findProgram(self: *Builder, names: []const []const u8, paths: []const []const u8) ![]const u8 {951 pub fn findProgram(self: *Builder, names: []const []const u8, paths: []const []const u8) ![]const u8 {
952 // TODO report error for ambiguous situations952 // TODO report error for ambiguous situations
953 const exe_extension = @as(CrossTarget, .{}).exeFileExt();953 const exe_extension = @as(CrossTarget, .{}).exeFileExt();
954 for (self.search_prefixes.span()) |search_prefix| {954 for (self.search_prefixes.items) |search_prefix| {
955 for (names) |name| {955 for (names) |name| {
956 if (fs.path.isAbsolute(name)) {956 if (fs.path.isAbsolute(name)) {
957 return name;957 return name;
...@@ -1096,7 +1096,7 @@ pub const Builder = struct {...@@ -1096,7 +1096,7 @@ pub const Builder = struct {
1096 .desc = tok_it.rest(),1096 .desc = tok_it.rest(),
1097 });1097 });
1098 }1098 }
1099 return list.span();1099 return list.items;
1100 }1100 }
11011101
1102 fn getPkgConfigList(self: *Builder) ![]const PkgConfigPkg {1102 fn getPkgConfigList(self: *Builder) ![]const PkgConfigPkg {
...@@ -1504,7 +1504,7 @@ pub const LibExeObjStep = struct {...@@ -1504,7 +1504,7 @@ pub const LibExeObjStep = struct {
1504 if (isLibCLibrary(name)) {1504 if (isLibCLibrary(name)) {
1505 return self.is_linking_libc;1505 return self.is_linking_libc;
1506 }1506 }
1507 for (self.link_objects.span()) |link_object| {1507 for (self.link_objects.items) |link_object| {
1508 switch (link_object) {1508 switch (link_object) {
1509 LinkObject.SystemLib => |n| if (mem.eql(u8, n, name)) return true,1509 LinkObject.SystemLib => |n| if (mem.eql(u8, n, name)) return true,
1510 else => continue,1510 else => continue,
...@@ -1903,7 +1903,7 @@ pub const LibExeObjStep = struct {...@@ -1903,7 +1903,7 @@ pub const LibExeObjStep = struct {
1903 self.include_dirs.append(IncludeDir{ .OtherStep = other }) catch unreachable;1903 self.include_dirs.append(IncludeDir{ .OtherStep = other }) catch unreachable;
19041904
1905 // Inherit dependency on system libraries1905 // Inherit dependency on system libraries
1906 for (other.link_objects.span()) |link_object| {1906 for (other.link_objects.items) |link_object| {
1907 switch (link_object) {1907 switch (link_object) {
1908 .SystemLib => |name| self.linkSystemLibrary(name),1908 .SystemLib => |name| self.linkSystemLibrary(name),
1909 else => continue,1909 else => continue,
...@@ -1965,7 +1965,7 @@ pub const LibExeObjStep = struct {...@@ -1965,7 +1965,7 @@ pub const LibExeObjStep = struct {
1965 if (self.root_src) |root_src| try zig_args.append(root_src.getPath(builder));1965 if (self.root_src) |root_src| try zig_args.append(root_src.getPath(builder));
19661966
1967 var prev_has_extra_flags = false;1967 var prev_has_extra_flags = false;
1968 for (self.link_objects.span()) |link_object| {1968 for (self.link_objects.items) |link_object| {
1969 switch (link_object) {1969 switch (link_object) {
1970 .StaticPath => |static_path| {1970 .StaticPath => |static_path| {
1971 try zig_args.append(builder.pathFromRoot(static_path));1971 try zig_args.append(builder.pathFromRoot(static_path));
...@@ -2035,7 +2035,7 @@ pub const LibExeObjStep = struct {...@@ -2035,7 +2035,7 @@ pub const LibExeObjStep = struct {
2035 &[_][]const u8{ builder.cache_root, builder.fmt("{}_build_options.zig", .{self.name}) },2035 &[_][]const u8{ builder.cache_root, builder.fmt("{}_build_options.zig", .{self.name}) },
2036 );2036 );
2037 const path_from_root = builder.pathFromRoot(build_options_file);2037 const path_from_root = builder.pathFromRoot(build_options_file);
2038 try fs.cwd().writeFile(path_from_root, self.build_options_contents.span());2038 try fs.cwd().writeFile(path_from_root, self.build_options_contents.items);
2039 try zig_args.append("--pkg-begin");2039 try zig_args.append("--pkg-begin");
2040 try zig_args.append("build_options");2040 try zig_args.append("build_options");
2041 try zig_args.append(path_from_root);2041 try zig_args.append(path_from_root);
...@@ -2233,11 +2233,11 @@ pub const LibExeObjStep = struct {...@@ -2233,11 +2233,11 @@ pub const LibExeObjStep = struct {
2233 },2233 },
2234 }2234 }
22352235
2236 for (self.packages.span()) |pkg| {2236 for (self.packages.items) |pkg| {
2237 try self.makePackageCmd(pkg, &zig_args);2237 try self.makePackageCmd(pkg, &zig_args);
2238 }2238 }
22392239
2240 for (self.include_dirs.span()) |include_dir| {2240 for (self.include_dirs.items) |include_dir| {
2241 switch (include_dir) {2241 switch (include_dir) {
2242 .RawPath => |include_path| {2242 .RawPath => |include_path| {
2243 try zig_args.append("-I");2243 try zig_args.append("-I");
...@@ -2255,18 +2255,18 @@ pub const LibExeObjStep = struct {...@@ -2255,18 +2255,18 @@ pub const LibExeObjStep = struct {
2255 }2255 }
2256 }2256 }
22572257
2258 for (self.lib_paths.span()) |lib_path| {2258 for (self.lib_paths.items) |lib_path| {
2259 try zig_args.append("-L");2259 try zig_args.append("-L");
2260 try zig_args.append(lib_path);2260 try zig_args.append(lib_path);
2261 }2261 }
22622262
2263 for (self.c_macros.span()) |c_macro| {2263 for (self.c_macros.items) |c_macro| {
2264 try zig_args.append("-D");2264 try zig_args.append("-D");
2265 try zig_args.append(c_macro);2265 try zig_args.append(c_macro);
2266 }2266 }
22672267
2268 if (self.target.isDarwin()) {2268 if (self.target.isDarwin()) {
2269 for (self.framework_dirs.span()) |dir| {2269 for (self.framework_dirs.items) |dir| {
2270 try zig_args.append("-F");2270 try zig_args.append("-F");
2271 try zig_args.append(dir);2271 try zig_args.append(dir);
2272 }2272 }
...@@ -2322,11 +2322,11 @@ pub const LibExeObjStep = struct {...@@ -2322,11 +2322,11 @@ pub const LibExeObjStep = struct {
2322 }2322 }
23232323
2324 if (self.kind == Kind.Test) {2324 if (self.kind == Kind.Test) {
2325 try builder.spawnChild(zig_args.span());2325 try builder.spawnChild(zig_args.items);
2326 } else {2326 } else {
2327 try zig_args.append("--enable-cache");2327 try zig_args.append("--enable-cache");
23282328
2329 const output_dir_nl = try builder.execFromStep(zig_args.span(), &self.step);2329 const output_dir_nl = try builder.execFromStep(zig_args.items, &self.step);
2330 const build_output_dir = mem.trimRight(u8, output_dir_nl, "\r\n");2330 const build_output_dir = mem.trimRight(u8, output_dir_nl, "\r\n");
23312331
2332 if (self.output_dir) |output_dir| {2332 if (self.output_dir) |output_dir| {
lib/std/build/emit_raw.zig+6-6
...@@ -79,7 +79,7 @@ const BinaryElfOutput = struct {...@@ -79,7 +79,7 @@ const BinaryElfOutput = struct {
79 newSegment.binaryOffset = 0;79 newSegment.binaryOffset = 0;
80 newSegment.firstSection = null;80 newSegment.firstSection = null;
8181
82 for (self.sections.span()) |section| {82 for (self.sections.items) |section| {
83 if (sectionWithinSegment(section, phdr)) {83 if (sectionWithinSegment(section, phdr)) {
84 if (section.segment) |sectionSegment| {84 if (section.segment) |sectionSegment| {
85 if (sectionSegment.elfOffset > newSegment.elfOffset) {85 if (sectionSegment.elfOffset > newSegment.elfOffset) {
...@@ -99,7 +99,7 @@ const BinaryElfOutput = struct {...@@ -99,7 +99,7 @@ const BinaryElfOutput = struct {
99 }99 }
100 }100 }
101101
102 sort.sort(*BinaryElfSegment, self.segments.span(), {}, segmentSortCompare);102 sort.sort(*BinaryElfSegment, self.segments.items, {}, segmentSortCompare);
103103
104 if (self.segments.items.len > 0) {104 if (self.segments.items.len > 0) {
105 const firstSegment = self.segments.items[0];105 const firstSegment = self.segments.items[0];
...@@ -112,19 +112,19 @@ const BinaryElfOutput = struct {...@@ -112,19 +112,19 @@ const BinaryElfOutput = struct {
112112
113 const basePhysicalAddress = firstSegment.physicalAddress;113 const basePhysicalAddress = firstSegment.physicalAddress;
114114
115 for (self.segments.span()) |segment| {115 for (self.segments.items) |segment| {
116 segment.binaryOffset = segment.physicalAddress - basePhysicalAddress;116 segment.binaryOffset = segment.physicalAddress - basePhysicalAddress;
117 }117 }
118 }118 }
119 }119 }
120120
121 for (self.sections.span()) |section| {121 for (self.sections.items) |section| {
122 if (section.segment) |segment| {122 if (section.segment) |segment| {
123 section.binaryOffset = segment.binaryOffset + (section.elfOffset - segment.elfOffset);123 section.binaryOffset = segment.binaryOffset + (section.elfOffset - segment.elfOffset);
124 }124 }
125 }125 }
126126
127 sort.sort(*BinaryElfSection, self.sections.span(), {}, sectionSortCompare);127 sort.sort(*BinaryElfSection, self.sections.items, {}, sectionSortCompare);
128128
129 return self;129 return self;
130 }130 }
...@@ -172,7 +172,7 @@ fn emitRaw(allocator: *Allocator, elf_path: []const u8, raw_path: []const u8) !v...@@ -172,7 +172,7 @@ fn emitRaw(allocator: *Allocator, elf_path: []const u8, raw_path: []const u8) !v
172 var binary_elf_output = try BinaryElfOutput.parse(allocator, elf_file);172 var binary_elf_output = try BinaryElfOutput.parse(allocator, elf_file);
173 defer binary_elf_output.deinit();173 defer binary_elf_output.deinit();
174174
175 for (binary_elf_output.sections.span()) |section| {175 for (binary_elf_output.sections.items) |section| {
176 try writeBinaryElfSection(elf_file, out_file, section);176 try writeBinaryElfSection(elf_file, out_file, section);
177 }177 }
178}178}
lib/std/build/run.zig+3-3
...@@ -159,7 +159,7 @@ pub const RunStep = struct {...@@ -159,7 +159,7 @@ pub const RunStep = struct {
159 const cwd = if (self.cwd) |cwd| self.builder.pathFromRoot(cwd) else self.builder.build_root;159 const cwd = if (self.cwd) |cwd| self.builder.pathFromRoot(cwd) else self.builder.build_root;
160160
161 var argv_list = ArrayList([]const u8).init(self.builder.allocator);161 var argv_list = ArrayList([]const u8).init(self.builder.allocator);
162 for (self.argv.span()) |arg| {162 for (self.argv.items) |arg| {
163 switch (arg) {163 switch (arg) {
164 Arg.Bytes => |bytes| try argv_list.append(bytes),164 Arg.Bytes => |bytes| try argv_list.append(bytes),
165 Arg.WriteFile => |file| {165 Arg.WriteFile => |file| {
...@@ -176,7 +176,7 @@ pub const RunStep = struct {...@@ -176,7 +176,7 @@ pub const RunStep = struct {
176 }176 }
177 }177 }
178178
179 const argv = argv_list.span();179 const argv = argv_list.items;
180180
181 const child = std.ChildProcess.init(argv, self.builder.allocator) catch unreachable;181 const child = std.ChildProcess.init(argv, self.builder.allocator) catch unreachable;
182 defer child.deinit();182 defer child.deinit();
...@@ -312,7 +312,7 @@ pub const RunStep = struct {...@@ -312,7 +312,7 @@ pub const RunStep = struct {
312 }312 }
313313
314 fn addPathForDynLibs(self: *RunStep, artifact: *LibExeObjStep) void {314 fn addPathForDynLibs(self: *RunStep, artifact: *LibExeObjStep) void {
315 for (artifact.link_objects.span()) |link_object| {315 for (artifact.link_objects.items) |link_object| {
316 switch (link_object) {316 switch (link_object) {
317 .OtherStep => |other| {317 .OtherStep => |other| {
318 if (other.target.isWindows() and other.isDynamicLibrary()) {318 if (other.target.isWindows() and other.isDynamicLibrary()) {
lib/std/build/translate_c.zig+1-1
...@@ -86,7 +86,7 @@ pub const TranslateCStep = struct {...@@ -86,7 +86,7 @@ pub const TranslateCStep = struct {
8686
87 try argv_list.append(self.source.getPath(self.builder));87 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);
90 const output_path = mem.trimRight(u8, output_path_nl, "\r\n");90 const output_path = mem.trimRight(u8, output_path_nl, "\r\n");
9191
92 self.out_basename = fs.path.basename(output_path);92 self.out_basename = fs.path.basename(output_path);
lib/std/build/write_file.zig+2-2
...@@ -64,7 +64,7 @@ pub const WriteFileStep = struct {...@@ -64,7 +64,7 @@ pub const WriteFileStep = struct {
64 // new random bytes when WriteFileStep implementation is modified64 // new random bytes when WriteFileStep implementation is modified
65 // in a non-backwards-compatible way.65 // in a non-backwards-compatible way.
66 hash.update("eagVR1dYXoE7ARDP");66 hash.update("eagVR1dYXoE7ARDP");
67 for (self.files.span()) |file| {67 for (self.files.items) |file| {
68 hash.update(file.basename);68 hash.update(file.basename);
69 hash.update(file.bytes);69 hash.update(file.bytes);
70 hash.update("|");70 hash.update("|");
...@@ -85,7 +85,7 @@ pub const WriteFileStep = struct {...@@ -85,7 +85,7 @@ pub const WriteFileStep = struct {
85 };85 };
86 var dir = try fs.cwd().openDir(self.output_dir, .{});86 var dir = try fs.cwd().openDir(self.output_dir, .{});
87 defer dir.close();87 defer dir.close();
88 for (self.files.span()) |file| {88 for (self.files.items) |file| {
89 dir.writeFile(file.basename, file.bytes) catch |err| {89 dir.writeFile(file.basename, file.bytes) catch |err| {
90 warn("unable to write {} into {}: {}\n", .{90 warn("unable to write {} into {}: {}\n", .{
91 file.basename,91 file.basename,
lib/std/coff.zig+2-2
...@@ -216,7 +216,7 @@ pub const Coff = struct {...@@ -216,7 +216,7 @@ pub const Coff = struct {
216 blk: while (i < debug_dir_entry_count) : (i += 1) {216 blk: while (i < debug_dir_entry_count) : (i += 1) {
217 const debug_dir_entry = try in.readStruct(DebugDirectoryEntry);217 const debug_dir_entry = try in.readStruct(DebugDirectoryEntry);
218 if (debug_dir_entry.type == IMAGE_DEBUG_TYPE_CODEVIEW) {218 if (debug_dir_entry.type == IMAGE_DEBUG_TYPE_CODEVIEW) {
219 for (self.sections.span()) |*section| {219 for (self.sections.items) |*section| {
220 const section_start = section.header.virtual_address;220 const section_start = section.header.virtual_address;
221 const section_size = section.header.misc.virtual_size;221 const section_size = section.header.misc.virtual_size;
222 const rva = debug_dir_entry.address_of_raw_data;222 const rva = debug_dir_entry.address_of_raw_data;
...@@ -282,7 +282,7 @@ pub const Coff = struct {...@@ -282,7 +282,7 @@ pub const Coff = struct {
282 }282 }
283283
284 pub fn getSection(self: *Coff, comptime name: []const u8) ?*Section {284 pub fn getSection(self: *Coff, comptime name: []const u8) ?*Section {
285 for (self.sections.span()) |*sec| {285 for (self.sections.items) |*sec| {
286 if (mem.eql(u8, sec.header.name[0..name.len], name)) {286 if (mem.eql(u8, sec.header.name[0..name.len], name)) {
287 return sec;287 return sec;
288 }288 }
lib/std/debug.zig+1-1
...@@ -1507,7 +1507,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) {...@@ -1507,7 +1507,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) {
1507 const mod_index = for (self.sect_contribs) |sect_contrib| {1507 const mod_index = for (self.sect_contribs) |sect_contrib| {
1508 if (sect_contrib.Section > self.coff.sections.items.len) continue;1508 if (sect_contrib.Section > self.coff.sections.items.len) continue;
1509 // Remember that SectionContribEntry.Section is 1-based.1509 // Remember that SectionContribEntry.Section is 1-based.
1510 coff_section = &self.coff.sections.span()[sect_contrib.Section - 1];1510 coff_section = &self.coff.sections.items[sect_contrib.Section - 1];
15111511
1512 const vaddr_start = coff_section.header.virtual_address + sect_contrib.Offset;1512 const vaddr_start = coff_section.header.virtual_address + sect_contrib.Offset;
1513 const vaddr_end = vaddr_start + sect_contrib.Size;1513 const vaddr_end = vaddr_start + sect_contrib.Size;
lib/std/dwarf.zig+7-7
...@@ -87,7 +87,7 @@ const Die = struct {...@@ -87,7 +87,7 @@ const Die = struct {
87 };87 };
8888
89 fn getAttr(self: *const Die, id: u64) ?*const FormValue {89 fn getAttr(self: *const Die, id: u64) ?*const FormValue {
90 for (self.attrs.span()) |*attr| {90 for (self.attrs.items) |*attr| {
91 if (attr.id == id) return &attr.value;91 if (attr.id == id) return &attr.value;
92 }92 }
93 return null;93 return null;
...@@ -371,7 +371,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: anytype, form_id: u64, e...@@ -371,7 +371,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: anytype, form_id: u64, e
371}371}
372372
373fn getAbbrevTableEntry(abbrev_table: *const AbbrevTable, abbrev_code: u64) ?*const AbbrevTableEntry {373fn getAbbrevTableEntry(abbrev_table: *const AbbrevTable, abbrev_code: u64) ?*const AbbrevTableEntry {
374 for (abbrev_table.span()) |*table_entry| {374 for (abbrev_table.items) |*table_entry| {
375 if (table_entry.abbrev_code == abbrev_code) return table_entry;375 if (table_entry.abbrev_code == abbrev_code) return table_entry;
376 }376 }
377 return null;377 return null;
...@@ -395,7 +395,7 @@ pub const DwarfInfo = struct {...@@ -395,7 +395,7 @@ pub const DwarfInfo = struct {
395 }395 }
396396
397 pub fn getSymbolName(di: *DwarfInfo, address: u64) ?[]const u8 {397 pub fn getSymbolName(di: *DwarfInfo, address: u64) ?[]const u8 {
398 for (di.func_list.span()) |*func| {398 for (di.func_list.items) |*func| {
399 if (func.pc_range) |range| {399 if (func.pc_range) |range| {
400 if (address >= range.start and address < range.end) {400 if (address >= range.start and address < range.end) {
401 return func.name;401 return func.name;
...@@ -584,7 +584,7 @@ pub const DwarfInfo = struct {...@@ -584,7 +584,7 @@ pub const DwarfInfo = struct {
584 }584 }
585585
586 pub fn findCompileUnit(di: *DwarfInfo, target_address: u64) !*const CompileUnit {586 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| {
588 if (compile_unit.pc_range) |range| {588 if (compile_unit.pc_range) |range| {
589 if (target_address >= range.start and target_address < range.end) return compile_unit;589 if (target_address >= range.start and target_address < range.end) return compile_unit;
590 }590 }
...@@ -632,7 +632,7 @@ pub const DwarfInfo = struct {...@@ -632,7 +632,7 @@ pub const DwarfInfo = struct {
632 /// Gets an already existing AbbrevTable given the abbrev_offset, or if not found,632 /// Gets an already existing AbbrevTable given the abbrev_offset, or if not found,
633 /// seeks in the stream and parses it.633 /// seeks in the stream and parses it.
634 fn getAbbrevTable(di: *DwarfInfo, abbrev_offset: u64) !*const AbbrevTable {634 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| {
636 if (header.offset == abbrev_offset) {636 if (header.offset == abbrev_offset) {
637 return &header.table;637 return &header.table;
638 }638 }
...@@ -686,7 +686,7 @@ pub const DwarfInfo = struct {...@@ -686,7 +686,7 @@ pub const DwarfInfo = struct {
686 .attrs = ArrayList(Die.Attr).init(di.allocator()),686 .attrs = ArrayList(Die.Attr).init(di.allocator()),
687 };687 };
688 try result.attrs.resize(table_entry.attrs.items.len);688 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| {
690 result.attrs.items[i] = Die.Attr{690 result.attrs.items[i] = Die.Attr{
691 .id = attr.attr_id,691 .id = attr.attr_id,
692 .value = try parseFormValue(di.allocator(), in_stream, attr.form_id, di.endian, is_64),692 .value = try parseFormValue(di.allocator(), in_stream, attr.form_id, di.endian, is_64),
...@@ -753,7 +753,7 @@ pub const DwarfInfo = struct {...@@ -753,7 +753,7 @@ pub const DwarfInfo = struct {
753 }753 }
754754
755 var file_entries = ArrayList(FileEntry).init(di.allocator());755 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
758 while (true) {758 while (true) {
759 const file_name = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize));759 const file_name = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize));
lib/std/fs.zig+3-3
...@@ -2138,7 +2138,7 @@ pub const Walker = struct {...@@ -2138,7 +2138,7 @@ pub const Walker = struct {
2138 while (true) {2138 while (true) {
2139 if (self.stack.items.len == 0) return null;2139 if (self.stack.items.len == 0) return null;
2140 // `top` becomes invalid after appending to `self.stack`.2140 // `top` becomes invalid after appending to `self.stack`.
2141 const top = &self.stack.span()[self.stack.items.len - 1];2141 const top = &self.stack.items[self.stack.items.len - 1];
2142 const dirname_len = top.dirname_len;2142 const dirname_len = top.dirname_len;
2143 if (try top.dir_it.next()) |base| {2143 if (try top.dir_it.next()) |base| {
2144 self.name_buffer.shrink(dirname_len);2144 self.name_buffer.shrink(dirname_len);
...@@ -2159,8 +2159,8 @@ pub const Walker = struct {...@@ -2159,8 +2159,8 @@ pub const Walker = struct {
2159 }2159 }
2160 return Entry{2160 return Entry{
2161 .dir = top.dir_it.dir,2161 .dir = top.dir_it.dir,
2162 .basename = self.name_buffer.span()[dirname_len + 1 ..],2162 .basename = self.name_buffer.items[dirname_len + 1 ..],
2163 .path = self.name_buffer.span(),2163 .path = self.name_buffer.items,
2164 .kind = base.kind,2164 .kind = base.kind,
2165 };2165 };
2166 } else {2166 } else {
lib/std/io/reader.zig+1-1
...@@ -62,7 +62,7 @@ pub fn Reader(...@@ -62,7 +62,7 @@ pub fn Reader(
62 var start_index: usize = original_len;62 var start_index: usize = original_len;
63 while (true) {63 while (true) {
64 array_list.expandToCapacity();64 array_list.expandToCapacity();
65 const dest_slice = array_list.span()[start_index..];65 const dest_slice = array_list.items[start_index..];
66 const bytes_read = try self.readAll(dest_slice);66 const bytes_read = try self.readAll(dest_slice);
67 start_index += bytes_read;67 start_index += bytes_read;
6868
lib/std/json.zig+2-2
...@@ -1270,7 +1270,7 @@ pub const Value = union(enum) {...@@ -1270,7 +1270,7 @@ pub const Value = union(enum) {
1270 .Integer => |inner| try stringify(inner, options, out_stream),1270 .Integer => |inner| try stringify(inner, options, out_stream),
1271 .Float => |inner| try stringify(inner, options, out_stream),1271 .Float => |inner| try stringify(inner, options, out_stream),
1272 .String => |inner| try stringify(inner, options, out_stream),1272 .String => |inner| try stringify(inner, options, out_stream),
1273 .Array => |inner| try stringify(inner.span(), options, out_stream),1273 .Array => |inner| try stringify(inner.items, options, out_stream),
1274 .Object => |inner| {1274 .Object => |inner| {
1275 try out_stream.writeByte('{');1275 try out_stream.writeByte('{');
1276 var field_output = false;1276 var field_output = false;
...@@ -2057,7 +2057,7 @@ pub const Parser = struct {...@@ -2057,7 +2057,7 @@ pub const Parser = struct {
2057 }2057 }
20582058
2059 fn pushToParent(p: *Parser, value: *const Value) !void {2059 fn pushToParent(p: *Parser, value: *const Value) !void {
2060 switch (p.stack.span()[p.stack.items.len - 1]) {2060 switch (p.stack.items[p.stack.items.len - 1]) {
2061 // Object Parent -> [ ..., object, <key>, value ]2061 // Object Parent -> [ ..., object, <key>, value ]
2062 Value.String => |key| {2062 Value.String => |key| {
2063 _ = p.stack.pop();2063 _ = p.stack.pop();
lib/std/net.zig+6-6
...@@ -796,7 +796,7 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !*...@@ -796,7 +796,7 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !*
796 result.canon_name = canon.toOwnedSlice();796 result.canon_name = canon.toOwnedSlice();
797 }797 }
798798
799 for (lookup_addrs.span()) |lookup_addr, i| {799 for (lookup_addrs.items) |lookup_addr, i| {
800 result.addrs[i] = lookup_addr.addr;800 result.addrs[i] = lookup_addr.addr;
801 assert(result.addrs[i].getPort() == port);801 assert(result.addrs[i].getPort() == port);
802 }802 }
...@@ -849,7 +849,7 @@ fn linuxLookupName(...@@ -849,7 +849,7 @@ fn linuxLookupName(
849 // No further processing is needed if there are fewer than 2849 // No further processing is needed if there are fewer than 2
850 // results or if there are only IPv4 results.850 // results or if there are only IPv4 results.
851 if (addrs.items.len == 1 or family == os.AF_INET) return;851 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| {
853 if (addr.addr.any.family != os.AF_INET) break false;853 if (addr.addr.any.family != os.AF_INET) break false;
854 } else true;854 } else true;
855 if (all_ip4) return;855 if (all_ip4) return;
...@@ -861,7 +861,7 @@ fn linuxLookupName(...@@ -861,7 +861,7 @@ fn linuxLookupName(
861 // So far the label/precedence table cannot be customized.861 // So far the label/precedence table cannot be customized.
862 // This implementation is ported from musl libc.862 // This implementation is ported from musl libc.
863 // A more idiomatic "ziggy" implementation would be welcome.863 // A more idiomatic "ziggy" implementation would be welcome.
864 for (addrs.span()) |*addr, i| {864 for (addrs.items) |*addr, i| {
865 var key: i32 = 0;865 var key: i32 = 0;
866 var sa6: os.sockaddr_in6 = undefined;866 var sa6: os.sockaddr_in6 = undefined;
867 @memset(@ptrCast([*]u8, &sa6), 0, @sizeOf(os.sockaddr_in6));867 @memset(@ptrCast([*]u8, &sa6), 0, @sizeOf(os.sockaddr_in6));
...@@ -926,7 +926,7 @@ fn linuxLookupName(...@@ -926,7 +926,7 @@ fn linuxLookupName(
926 key |= (MAXADDRS - @intCast(i32, i)) << DAS_ORDER_SHIFT;926 key |= (MAXADDRS - @intCast(i32, i)) << DAS_ORDER_SHIFT;
927 addr.sortkey = key;927 addr.sortkey = key;
928 }928 }
929 std.sort.sort(LookupAddr, addrs.span(), {}, addrCmpLessThan);929 std.sort.sort(LookupAddr, addrs.items, {}, addrCmpLessThan);
930}930}
931931
932const Policy = struct {932const Policy = struct {
...@@ -1361,9 +1361,9 @@ fn resMSendRc(...@@ -1361,9 +1361,9 @@ fn resMSendRc(
1361 defer ns_list.deinit();1361 defer ns_list.deinit();
13621362
1363 try ns_list.resize(rc.ns.items.len);1363 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| {
1367 ns[i] = iplit.addr;1367 ns[i] = iplit.addr;
1368 assert(ns[i].getPort() == 53);1368 assert(ns[i].getPort() == 53);
1369 if (iplit.addr.any.family != os.AF_INET) {1369 if (iplit.addr.any.family != os.AF_INET) {
lib/std/pdb.zig+1-1
...@@ -654,7 +654,7 @@ const MsfStream = struct {...@@ -654,7 +654,7 @@ const MsfStream = struct {
654 while (true) {654 while (true) {
655 const byte = try self.reader().readByte();655 const byte = try self.reader().readByte();
656 if (byte == 0) {656 if (byte == 0) {
657 return list.span();657 return list.items;
658 }658 }
659 try list.append(byte);659 try list.append(byte);
660 }660 }
lib/std/process.zig+2-2
...@@ -519,8 +519,8 @@ pub fn argsAlloc(allocator: *mem.Allocator) ![][:0]u8 {...@@ -519,8 +519,8 @@ pub fn argsAlloc(allocator: *mem.Allocator) ![][:0]u8 {
519 try slice_list.append(arg.len);519 try slice_list.append(arg.len);
520 }520 }
521521
522 const contents_slice = contents.span();522 const contents_slice = contents.items;
523 const slice_sizes = slice_list.span();523 const slice_sizes = slice_list.items;
524 const contents_size_bytes = try math.add(usize, contents_slice.len, slice_sizes.len);524 const contents_size_bytes = try math.add(usize, contents_slice.len, slice_sizes.len);
525 const slice_list_bytes = try math.mul(usize, @sizeOf([]u8), slice_sizes.len);525 const slice_list_bytes = try math.mul(usize, @sizeOf([]u8), slice_sizes.len);
526 const total_bytes = try math.add(usize, slice_list_bytes, contents_size_bytes);526 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 {...@@ -130,7 +130,7 @@ pub fn main() !void {
130 if (builder.validateUserInputDidItFail())130 if (builder.validateUserInputDidItFail())
131 return usageAndErr(builder, true, stderr_stream);131 return usageAndErr(builder, true, stderr_stream);
132132
133 builder.make(targets.span()) catch |err| {133 builder.make(targets.items) catch |err| {
134 switch (err) {134 switch (err) {
135 error.InvalidStepName => {135 error.InvalidStepName => {
136 return usageAndErr(builder, true, stderr_stream);136 return usageAndErr(builder, true, stderr_stream);
...@@ -165,7 +165,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void...@@ -165,7 +165,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
165 , .{builder.zig_exe});165 , .{builder.zig_exe});
166166
167 const allocator = builder.allocator;167 const allocator = builder.allocator;
168 for (builder.top_level_steps.span()) |top_level_step| {168 for (builder.top_level_steps.items) |top_level_step| {
169 const name = if (&top_level_step.step == builder.default_step)169 const name = if (&top_level_step.step == builder.default_step)
170 try fmt.allocPrint(allocator, "{} (default)", .{top_level_step.step.name})170 try fmt.allocPrint(allocator, "{} (default)", .{top_level_step.step.name})
171 else171 else
...@@ -189,7 +189,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void...@@ -189,7 +189,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
189 if (builder.available_options_list.items.len == 0) {189 if (builder.available_options_list.items.len == 0) {
190 try out_stream.print(" (none)\n", .{});190 try out_stream.print(" (none)\n", .{});
191 } else {191 } else {
192 for (builder.available_options_list.span()) |option| {192 for (builder.available_options_list.items) |option| {
193 const name = try fmt.allocPrint(allocator, " -D{}=[{}]", .{193 const name = try fmt.allocPrint(allocator, " -D{}=[{}]", .{
194 option.name,194 option.name,
195 Builder.typeIdName(option.type_id),195 Builder.typeIdName(option.type_id),
lib/std/zig/system.zig+1-1
...@@ -128,7 +128,7 @@ pub const NativePaths = struct {...@@ -128,7 +128,7 @@ pub const NativePaths = struct {
128 }128 }
129129
130 fn deinitArray(array: *ArrayList([:0]u8)) void {130 fn deinitArray(array: *ArrayList([:0]u8)) void {
131 for (array.span()) |item| {131 for (array.items) |item| {
132 array.allocator.free(item);132 array.allocator.free(item);
133 }133 }
134 array.deinit();134 array.deinit();
src/libc_installation.zig+3-3
...@@ -340,7 +340,7 @@ pub const LibCInstallation = struct {...@@ -340,7 +340,7 @@ pub const LibCInstallation = struct {
340 result_buf.shrink(0);340 result_buf.shrink(0);
341 try result_buf.outStream().print("{}\\Include\\{}\\ucrt", .{ search.path, search.version });341 try result_buf.outStream().print("{}\\Include\\{}\\ucrt", .{ search.path, search.version });
342342
343 var dir = fs.cwd().openDir(result_buf.span(), .{}) catch |err| switch (err) {343 var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) {
344 error.FileNotFound,344 error.FileNotFound,
345 error.NotDir,345 error.NotDir,
346 error.NoDevice,346 error.NoDevice,
...@@ -386,7 +386,7 @@ pub const LibCInstallation = struct {...@@ -386,7 +386,7 @@ pub const LibCInstallation = struct {
386 result_buf.shrink(0);386 result_buf.shrink(0);
387 try result_buf.outStream().print("{}\\Lib\\{}\\ucrt\\{}", .{ search.path, search.version, arch_sub_dir });387 try result_buf.outStream().print("{}\\Lib\\{}\\ucrt\\{}", .{ search.path, search.version, arch_sub_dir });
388388
389 var dir = fs.cwd().openDir(result_buf.span(), .{}) catch |err| switch (err) {389 var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) {
390 error.FileNotFound,390 error.FileNotFound,
391 error.NotDir,391 error.NotDir,
392 error.NoDevice,392 error.NoDevice,
...@@ -441,7 +441,7 @@ pub const LibCInstallation = struct {...@@ -441,7 +441,7 @@ pub const LibCInstallation = struct {
441 const stream = result_buf.outStream();441 const stream = result_buf.outStream();
442 try stream.print("{}\\Lib\\{}\\um\\{}", .{ search.path, search.version, arch_sub_dir });442 try stream.print("{}\\Lib\\{}\\um\\{}", .{ search.path, search.version, arch_sub_dir });
443443
444 var dir = fs.cwd().openDir(result_buf.span(), .{}) catch |err| switch (err) {444 var dir = fs.cwd().openDir(result_buf.items, .{}) catch |err| switch (err) {
445 error.FileNotFound,445 error.FileNotFound,
446 error.NotDir,446 error.NotDir,
447 error.NoDevice,447 error.NoDevice,
src/main.zig+3-3
...@@ -2505,7 +2505,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {...@@ -2505,7 +2505,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {
2505 defer fmt.seen.deinit();2505 defer fmt.seen.deinit();
2506 defer fmt.out_buffer.deinit();2506 defer fmt.out_buffer.deinit();
25072507
2508 for (input_files.span()) |file_path| {2508 for (input_files.items) |file_path| {
2509 // Get the real path here to avoid Windows failing on relative file paths with . or .. in them.2509 // Get the real path here to avoid Windows failing on relative file paths with . or .. in them.
2510 const real_path = fs.realpathAlloc(gpa, file_path) catch |err| {2510 const real_path = fs.realpathAlloc(gpa, file_path) catch |err| {
2511 fatal("unable to open '{}': {}", .{ file_path, err });2511 fatal("unable to open '{}': {}", .{ file_path, err });
...@@ -2685,7 +2685,7 @@ fn printErrMsgToFile(...@@ -2685,7 +2685,7 @@ fn printErrMsgToFile(
2685 defer text_buf.deinit();2685 defer text_buf.deinit();
2686 const out_stream = text_buf.outStream();2686 const out_stream = text_buf.outStream();
2687 try parse_error.render(tree.token_ids, out_stream);2687 try parse_error.render(tree.token_ids, out_stream);
2688 const text = text_buf.span();2688 const text = text_buf.items;
26892689
2690 const stream = file.outStream();2690 const stream = file.outStream();
2691 try stream.print("{}:{}:{}: error: {}\n", .{ path, start_loc.line + 1, start_loc.column + 1, text });2691 try stream.print("{}:{}:{}: error: {}\n", .{ path, start_loc.line + 1, start_loc.column + 1, text });
...@@ -2834,7 +2834,7 @@ pub const ClangArgIterator = struct {...@@ -2834,7 +2834,7 @@ pub const ClangArgIterator = struct {
2834 defer resp_arg_list.deinit();2834 defer resp_arg_list.deinit();
2835 {2835 {
2836 errdefer {2836 errdefer {
2837 for (resp_arg_list.span()) |item| {2837 for (resp_arg_list.items) |item| {
2838 allocator.free(mem.span(item));2838 allocator.free(mem.span(item));
2839 }2839 }
2840 }2840 }
src/translate_c.zig+1-1
...@@ -6564,7 +6564,7 @@ fn parseCUnaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!*ast.Nod...@@ -6564,7 +6564,7 @@ fn parseCUnaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!*ast.Nod
65646564
6565fn tokenSlice(c: *Context, token: ast.TokenIndex) []u8 {6565fn tokenSlice(c: *Context, token: ast.TokenIndex) []u8 {
6566 const tok = c.token_locs.items[token];6566 const tok = c.token_locs.items[token];
6567 const slice = c.source_buffer.span()[tok.start..tok.end];6567 const slice = c.source_buffer.items[tok.start..tok.end];
6568 return if (mem.startsWith(u8, slice, "@\""))6568 return if (mem.startsWith(u8, slice, "@\""))
6569 slice[2 .. slice.len - 1]6569 slice[2 .. slice.len - 1]
6570 else6570 else
test/src/compare_output.zig+4-4
...@@ -91,7 +91,7 @@ pub const CompareOutputContext = struct {...@@ -91,7 +91,7 @@ pub const CompareOutputContext = struct {
91 const b = self.b;91 const b = self.b;
9292
93 const write_src = b.addWriteFiles();93 const write_src = b.addWriteFiles();
94 for (case.sources.span()) |src_file| {94 for (case.sources.items) |src_file| {
95 write_src.add(src_file.filename, src_file.source);95 write_src.add(src_file.filename, src_file.source);
96 }96 }
9797
...@@ -105,7 +105,7 @@ pub const CompareOutputContext = struct {...@@ -105,7 +105,7 @@ pub const CompareOutputContext = struct {
105 }105 }
106106
107 const exe = b.addExecutable("test", null);107 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
110 const run = exe.run();110 const run = exe.run();
111 run.addArgs(case.cli_args);111 run.addArgs(case.cli_args);
...@@ -125,7 +125,7 @@ pub const CompareOutputContext = struct {...@@ -125,7 +125,7 @@ pub const CompareOutputContext = struct {
125 if (mem.indexOf(u8, annotated_case_name, filter) == null) continue;125 if (mem.indexOf(u8, annotated_case_name, filter) == null) continue;
126 }126 }
127127
128 const basename = case.sources.span()[0].filename;128 const basename = case.sources.items[0].filename;
129 const exe = b.addExecutableFromWriteFileStep("test", write_src, basename);129 const exe = b.addExecutableFromWriteFileStep("test", write_src, basename);
130 exe.setBuildMode(mode);130 exe.setBuildMode(mode);
131 if (case.link_libc) {131 if (case.link_libc) {
...@@ -146,7 +146,7 @@ pub const CompareOutputContext = struct {...@@ -146,7 +146,7 @@ pub const CompareOutputContext = struct {
146 if (mem.indexOf(u8, annotated_case_name, filter) == null) return;146 if (mem.indexOf(u8, annotated_case_name, filter) == null) return;
147 }147 }
148148
149 const basename = case.sources.span()[0].filename;149 const basename = case.sources.items[0].filename;
150 const exe = b.addExecutableFromWriteFileStep("test", write_src, basename);150 const exe = b.addExecutableFromWriteFileStep("test", write_src, basename);
151 if (case.link_libc) {151 if (case.link_libc) {
152 exe.linkSystemLibrary("c");152 exe.linkSystemLibrary("c");
test/src/run_translated_c.zig+2-2
...@@ -82,13 +82,13 @@ pub const RunTranslatedCContext = struct {...@@ -82,13 +82,13 @@ pub const RunTranslatedCContext = struct {
82 }82 }
8383
84 const write_src = b.addWriteFiles();84 const write_src = b.addWriteFiles();
85 for (case.sources.span()) |src_file| {85 for (case.sources.items) |src_file| {
86 write_src.add(src_file.filename, src_file.source);86 write_src.add(src_file.filename, src_file.source);
87 }87 }
88 const translate_c = b.addTranslateC(.{88 const translate_c = b.addTranslateC(.{
89 .write_file = .{89 .write_file = .{
90 .step = write_src,90 .step = write_src,
91 .basename = case.sources.span()[0].filename,91 .basename = case.sources.items[0].filename,
92 },92 },
93 });93 });
94 translate_c.step.name = b.fmt("{} translate-c", .{annotated_case_name});94 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 {...@@ -105,20 +105,20 @@ pub const TranslateCContext = struct {
105 }105 }
106106
107 const write_src = b.addWriteFiles();107 const write_src = b.addWriteFiles();
108 for (case.sources.span()) |src_file| {108 for (case.sources.items) |src_file| {
109 write_src.add(src_file.filename, src_file.source);109 write_src.add(src_file.filename, src_file.source);
110 }110 }
111111
112 const translate_c = b.addTranslateC(.{112 const translate_c = b.addTranslateC(.{
113 .write_file = .{113 .write_file = .{
114 .step = write_src,114 .step = write_src,
115 .basename = case.sources.span()[0].filename,115 .basename = case.sources.items[0].filename,
116 },116 },
117 });117 });
118 translate_c.step.name = annotated_case_name;118 translate_c.step.name = annotated_case_name;
119 translate_c.setTarget(case.target);119 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
123 self.step.dependOn(&check_file.step);123 self.step.dependOn(&check_file.step);
124 }124 }
test/standalone/brace_expansion/main.zig+5-5
...@@ -131,7 +131,7 @@ fn expandString(input: []const u8, output: *ArrayListSentineled(u8, 0)) !void {...@@ -131,7 +131,7 @@ fn expandString(input: []const u8, output: *ArrayListSentineled(u8, 0)) !void {
131 try expandNode(root, &result_list);131 try expandNode(root, &result_list);
132132
133 try output.resize(0);133 try output.resize(0);
134 for (result_list.span()) |buf, i| {134 for (result_list.items) |buf, i| {
135 if (i != 0) {135 if (i != 0) {
136 try output.append(' ');136 try output.append(' ');
137 }137 }
...@@ -157,8 +157,8 @@ fn expandNode(node: Node, output: *ArrayList(ArrayListSentineled(u8, 0))) Expand...@@ -157,8 +157,8 @@ fn expandNode(node: Node, output: *ArrayList(ArrayListSentineled(u8, 0))) Expand
157 var child_list_b = ArrayList(ArrayListSentineled(u8, 0)).init(global_allocator);157 var child_list_b = ArrayList(ArrayListSentineled(u8, 0)).init(global_allocator);
158 try expandNode(b_node, &child_list_b);158 try expandNode(b_node, &child_list_b);
159159
160 for (child_list_a.span()) |buf_a| {160 for (child_list_a.items) |buf_a| {
161 for (child_list_b.span()) |buf_b| {161 for (child_list_b.items) |buf_b| {
162 var combined_buf = try ArrayListSentineled(u8, 0).initFromBuffer(buf_a);162 var combined_buf = try ArrayListSentineled(u8, 0).initFromBuffer(buf_a);
163 try combined_buf.appendSlice(buf_b.span());163 try combined_buf.appendSlice(buf_b.span());
164 try output.append(combined_buf);164 try output.append(combined_buf);
...@@ -166,11 +166,11 @@ fn expandNode(node: Node, output: *ArrayList(ArrayListSentineled(u8, 0))) Expand...@@ -166,11 +166,11 @@ fn expandNode(node: Node, output: *ArrayList(ArrayListSentineled(u8, 0))) Expand
166 }166 }
167 },167 },
168 Node.List => |list| {168 Node.List => |list| {
169 for (list.span()) |child_node| {169 for (list.items) |child_node| {
170 var child_list = ArrayList(ArrayListSentineled(u8, 0)).init(global_allocator);170 var child_list = ArrayList(ArrayListSentineled(u8, 0)).init(global_allocator);
171 try expandNode(child_node, &child_list);171 try expandNode(child_node, &child_list);
172172
173 for (child_list.span()) |buf| {173 for (child_list.items) |buf| {
174 try output.append(buf);174 try output.append(buf);
175 }175 }
176 }176 }
tools/merge_anal_dumps.zig+12-12
...@@ -183,13 +183,13 @@ const Dump = struct {...@@ -183,13 +183,13 @@ const Dump = struct {
183 try mergeSameStrings(&self.zig_version, zig_version);183 try mergeSameStrings(&self.zig_version, zig_version);
184 try mergeSameStrings(&self.root_name, root_name);184 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| {
187 const target = json_build.Object.get("target").?.value.String;187 const target = json_build.Object.get("target").?.value.String;
188 try self.targets.append(target);188 try self.targets.append(target);
189 }189 }
190190
191 // Merge files. If the string matches, it's the same file.191 // 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;
193 var other_file_to_mine = std.AutoHashMap(usize, usize).init(self.a());193 var other_file_to_mine = std.AutoHashMap(usize, usize).init(self.a());
194 for (other_files) |other_file, i| {194 for (other_files) |other_file, i| {
195 const gop = try self.file_map.getOrPut(other_file.String);195 const gop = try self.file_map.getOrPut(other_file.String);
...@@ -201,7 +201,7 @@ const Dump = struct {...@@ -201,7 +201,7 @@ const Dump = struct {
201 }201 }
202202
203 // Merge AST nodes. If the file id, line, and column all match, it's the same AST node.203 // 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;
205 var other_ast_node_to_mine = std.AutoHashMap(usize, usize).init(self.a());205 var other_ast_node_to_mine = std.AutoHashMap(usize, usize).init(self.a());
206 for (other_ast_nodes) |other_ast_node_json, i| {206 for (other_ast_nodes) |other_ast_node_json, i| {
207 const other_file_id = jsonObjInt(other_ast_node_json, "file");207 const other_file_id = jsonObjInt(other_ast_node_json, "file");
...@@ -221,9 +221,9 @@ const Dump = struct {...@@ -221,9 +221,9 @@ const Dump = struct {
221 // convert fields lists221 // convert fields lists
222 for (other_ast_nodes) |other_ast_node_json, i| {222 for (other_ast_nodes) |other_ast_node_json, i| {
223 const my_node_index = other_ast_node_to_mine.get(i).?.value;223 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];
225 if (other_ast_node_json.Object.get("fields")) |fields_json_kv| {225 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;
227 my_node.fields = try self.a().alloc(usize, other_fields.len);227 my_node.fields = try self.a().alloc(usize, other_fields.len);
228 for (other_fields) |other_field_index, field_i| {228 for (other_fields) |other_field_index, field_i| {
229 const other_index = @intCast(usize, other_field_index.Integer);229 const other_index = @intCast(usize, other_field_index.Integer);
...@@ -233,7 +233,7 @@ const Dump = struct {...@@ -233,7 +233,7 @@ const Dump = struct {
233 }233 }
234234
235 // Merge errors. If the AST Node matches, it's the same error value.235 // 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;
237 var other_error_to_mine = std.AutoHashMap(usize, usize).init(self.a());237 var other_error_to_mine = std.AutoHashMap(usize, usize).init(self.a());
238 for (other_errors) |other_error_json, i| {238 for (other_errors) |other_error_json, i| {
239 const other_src_id = jsonObjInt(other_error_json, "src");239 const other_src_id = jsonObjInt(other_error_json, "src");
...@@ -253,7 +253,7 @@ const Dump = struct {...@@ -253,7 +253,7 @@ const Dump = struct {
253 // First we identify all the simple types and merge those.253 // First we identify all the simple types and merge those.
254 // Example: void, type, noreturn254 // Example: void, type, noreturn
255 // We can also do integers and floats.255 // 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;
257 var other_types_to_mine = std.AutoHashMap(usize, usize).init(self.a());257 var other_types_to_mine = std.AutoHashMap(usize, usize).init(self.a());
258 for (other_types) |other_type_json, i| {258 for (other_types) |other_type_json, i| {
259 const type_kind = jsonObjInt(other_type_json, "kind");259 const type_kind = jsonObjInt(other_type_json, "kind");
...@@ -336,7 +336,7 @@ const Dump = struct {...@@ -336,7 +336,7 @@ const Dump = struct {
336336
337 try jw.objectField("builds");337 try jw.objectField("builds");
338 try jw.beginArray();338 try jw.beginArray();
339 for (self.targets.span()) |target| {339 for (self.targets.items) |target| {
340 try jw.arrayElem();340 try jw.arrayElem();
341 try jw.beginObject();341 try jw.beginObject();
342 try jw.objectField("target");342 try jw.objectField("target");
...@@ -349,7 +349,7 @@ const Dump = struct {...@@ -349,7 +349,7 @@ const Dump = struct {
349349
350 try jw.objectField("types");350 try jw.objectField("types");
351 try jw.beginArray();351 try jw.beginArray();
352 for (self.type_list.span()) |t| {352 for (self.type_list.items) |t| {
353 try jw.arrayElem();353 try jw.arrayElem();
354 try jw.beginObject();354 try jw.beginObject();
355355
...@@ -379,7 +379,7 @@ const Dump = struct {...@@ -379,7 +379,7 @@ const Dump = struct {
379379
380 try jw.objectField("errors");380 try jw.objectField("errors");
381 try jw.beginArray();381 try jw.beginArray();
382 for (self.error_list.span()) |zig_error| {382 for (self.error_list.items) |zig_error| {
383 try jw.arrayElem();383 try jw.arrayElem();
384 try jw.beginObject();384 try jw.beginObject();
385385
...@@ -395,7 +395,7 @@ const Dump = struct {...@@ -395,7 +395,7 @@ const Dump = struct {
395395
396 try jw.objectField("astNodes");396 try jw.objectField("astNodes");
397 try jw.beginArray();397 try jw.beginArray();
398 for (self.node_list.span()) |node| {398 for (self.node_list.items) |node| {
399 try jw.arrayElem();399 try jw.arrayElem();
400 try jw.beginObject();400 try jw.beginObject();
401401
...@@ -425,7 +425,7 @@ const Dump = struct {...@@ -425,7 +425,7 @@ const Dump = struct {
425425
426 try jw.objectField("files");426 try jw.objectField("files");
427 try jw.beginArray();427 try jw.beginArray();
428 for (self.file_list.span()) |file| {428 for (self.file_list.items) |file| {
429 try jw.arrayElem();429 try jw.arrayElem();
430 try jw.emitString(file);430 try jw.emitString(file);
431 }431 }
tools/process_headers.zig+2-2
...@@ -325,7 +325,7 @@ pub fn main() !void {...@@ -325,7 +325,7 @@ pub fn main() !void {
325 },325 },
326 .os = .linux,326 .os = .linux,
327 };327 };
328 search: for (search_paths.span()) |search_path| {328 search: for (search_paths.items) |search_path| {
329 var sub_path: []const []const u8 = undefined;329 var sub_path: []const []const u8 = undefined;
330 switch (vendor) {330 switch (vendor) {
331 .musl => {331 .musl => {
...@@ -416,7 +416,7 @@ pub fn main() !void {...@@ -416,7 +416,7 @@ pub fn main() !void {
416 try contents_list.append(contents);416 try contents_list.append(contents);
417 }417 }
418 }418 }
419 std.sort.sort(*Contents, contents_list.span(), {}, Contents.hitCountLessThan);419 std.sort.sort(*Contents, contents_list.items, {}, Contents.hitCountLessThan);
420 const best_contents = contents_list.popOrNull().?;420 const best_contents = contents_list.popOrNull().?;
421 if (best_contents.hit_count > 1) {421 if (best_contents.hit_count > 1) {
422 // worth it to make it generic422 // worth it to make it generic
tools/update_clang_options.zig+5-5
...@@ -374,7 +374,7 @@ pub fn main() anyerror!void {...@@ -374,7 +374,7 @@ pub fn main() anyerror!void {
374 }374 }
375 // Some options have multiple matches. As an example, "-Wl,foo" matches both375 // Some options have multiple matches. As an example, "-Wl,foo" matches both
376 // "W" and "Wl,". So we sort this list in order of descending priority.376 // "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
379 var stdout_bos = std.io.bufferedOutStream(std.io.getStdOut().outStream());379 var stdout_bos = std.io.bufferedOutStream(std.io.getStdOut().outStream());
380 const stdout = stdout_bos.outStream();380 const stdout = stdout_bos.outStream();
...@@ -386,12 +386,12 @@ pub fn main() anyerror!void {...@@ -386,12 +386,12 @@ pub fn main() anyerror!void {
386 \\386 \\
387 );387 );
388388
389 for (all_objects.span()) |obj| {389 for (all_objects.items) |obj| {
390 const name = obj.get("Name").?.String;390 const name = obj.get("Name").?.String;
391 var pd1 = false;391 var pd1 = false;
392 var pd2 = false;392 var pd2 = false;
393 var pslash = false;393 var pslash = false;
394 for (obj.get("Prefixes").?.Array.span()) |prefix_json| {394 for (obj.get("Prefixes").?.Array.items) |prefix_json| {
395 const prefix = prefix_json.String;395 const prefix = prefix_json.String;
396 if (std.mem.eql(u8, prefix, "-")) {396 if (std.mem.eql(u8, prefix, "-")) {
397 pd1 = true;397 pd1 = true;
...@@ -502,7 +502,7 @@ const Syntax = union(enum) {...@@ -502,7 +502,7 @@ const Syntax = union(enum) {
502502
503fn objSyntax(obj: *json.ObjectMap) Syntax {503fn objSyntax(obj: *json.ObjectMap) Syntax {
504 const num_args = @intCast(u8, obj.get("NumArgs").?.Integer);504 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| {
506 const superclass = superclass_json.String;506 const superclass = superclass_json.String;
507 if (std.mem.eql(u8, superclass, "Joined")) {507 if (std.mem.eql(u8, superclass, "Joined")) {
508 return .joined;508 return .joined;
...@@ -548,7 +548,7 @@ fn objSyntax(obj: *json.ObjectMap) Syntax {...@@ -548,7 +548,7 @@ fn objSyntax(obj: *json.ObjectMap) Syntax {
548 }548 }
549 const key = obj.get("!name").?.String;549 const key = obj.get("!name").?.String;
550 std.debug.warn("{} (key {}) has unrecognized superclasses:\n", .{ name, key });550 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| {
552 std.debug.warn(" {}\n", .{superclass_json.String});552 std.debug.warn(" {}\n", .{superclass_json.String});
553 }553 }
554 std.process.exit(1);554 std.process.exit(1);
tools/update_glibc.zig+7-7
...@@ -225,15 +225,15 @@ pub fn main() !void {...@@ -225,15 +225,15 @@ pub fn main() !void {
225 var list = std.ArrayList([]const u8).init(allocator);225 var list = std.ArrayList([]const u8).init(allocator);
226 var it = global_fn_set.iterator();226 var it = global_fn_set.iterator();
227 while (it.next()) |entry| try list.append(entry.key);227 while (it.next()) |entry| try list.append(entry.key);
228 std.sort.sort([]const u8, list.span(), {}, strCmpLessThan);228 std.sort.sort([]const u8, list.items, {}, strCmpLessThan);
229 break :blk list.span();229 break :blk list.items;
230 };230 };
231 const global_ver_list = blk: {231 const global_ver_list = blk: {
232 var list = std.ArrayList([]const u8).init(allocator);232 var list = std.ArrayList([]const u8).init(allocator);
233 var it = global_ver_set.iterator();233 var it = global_ver_set.iterator();
234 while (it.next()) |entry| try list.append(entry.key);234 while (it.next()) |entry| try list.append(entry.key);
235 std.sort.sort([]const u8, list.span(), {}, versionLessThan);235 std.sort.sort([]const u8, list.items, {}, versionLessThan);
236 break :blk list.span();236 break :blk list.items;
237 };237 };
238 {238 {
239 const vers_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "vers.txt" });239 const vers_txt_path = try fs.path.join(allocator, &[_][]const u8{ glibc_out_dir, "vers.txt" });
...@@ -266,13 +266,13 @@ pub fn main() !void {...@@ -266,13 +266,13 @@ pub fn main() !void {
266 for (abi_lists) |*abi_list, abi_index| {266 for (abi_lists) |*abi_list, abi_index| {
267 const entry = target_functions.getEntry(@ptrToInt(abi_list)).?;267 const entry = target_functions.getEntry(@ptrToInt(abi_list)).?;
268 const fn_vers_list = &entry.value.fn_vers_list;268 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| {
270 const gop = try fn_vers_list.getOrPut(ver_fn.name);270 const gop = try fn_vers_list.getOrPut(ver_fn.name);
271 if (!gop.found_existing) {271 if (!gop.found_existing) {
272 gop.entry.value = std.ArrayList(usize).init(allocator);272 gop.entry.value = std.ArrayList(usize).init(allocator);
273 }273 }
274 const ver_index = global_ver_set.getEntry(ver_fn.ver).?.value;274 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) {
276 try gop.entry.value.append(ver_index);276 try gop.entry.value.append(ver_index);
277 }277 }
278 }278 }
...@@ -299,7 +299,7 @@ pub fn main() !void {...@@ -299,7 +299,7 @@ pub fn main() !void {
299 try abilist_txt.writeByte('\n');299 try abilist_txt.writeByte('\n');
300 continue;300 continue;
301 };301 };
302 for (entry.value.span()) |ver_index, it_i| {302 for (entry.value.items) |ver_index, it_i| {
303 if (it_i != 0) try abilist_txt.writeByte(' ');303 if (it_i != 0) try abilist_txt.writeByte(' ');
304 try abilist_txt.print("{d}", .{ver_index});304 try abilist_txt.print("{d}", .{ver_index});
305 }305 }