authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-30 21:19:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:35-07:00
logc57bf9904396c365191d25b9ce6410bb47daa96a
tree17fd3c630e10b36197f349c2b23acf03b52aad4f
parent364a1400ffb7c88539a34d86c83245478b096b84

Configuration: implement Storage.UnionList.tag


4 files changed, 16 insertions(+), 8 deletions(-)

BRANCH_TODO+3-1
......@@ -2,7 +2,6 @@
22* inspect b4ffb402c082605c4b324e88120306fc8fb3cf32 diff and apply changes as needed (merge conflict)
33* make zig-pkg path root configurable in maker (make sure --system still works)
44* eliminate calls to getPath, getPath2, getPath3
5* [build system compile step data races with getGraph function](https://codeberg.org/ziglang/zig/issues/31397)
65* test lazyImport
76* solve the TODOs added in this branch
87* get zig tests passing
......@@ -17,6 +16,7 @@
1716* refactor with DefaultingEnum
1817
1918* implement {q} or delete {q} uses
19* make the generated dependencies.zig be dependencies.zon and don't put absolute paths in there
2020
2121## Followup Issues
2222* reduce the size of Maker.Step.Extended (make Run smaller) probably by using an arena per make
......@@ -49,3 +49,5 @@ run_cmd.addPassthruArgs();
4949This removes a capability from build scripts since they can no longer observe
5050those arguments. In exchange, it means that when changing those arguments,
5151build scripts no longer must be rebuilt from source.
52
53closes #31397
lib/compiler/Maker/ScannedConfig.zig+9
......@@ -79,6 +79,15 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi
7979 try printStruct(sc, &sub_struct, Configuration.Step.Run.Arg, field_value.get(c));
8080 try sub_struct.end();
8181 },
82 Configuration.LazyPath.Index => {
83 switch (field_value.get(c)) {
84 inline else => |u| {
85 var sub_struct = try s.beginStruct(.{});
86 try printStruct(sc, &sub_struct, @TypeOf(u), u);
87 try sub_struct.end();
88 },
89 }
90 },
8291 else => switch (@typeInfo(Field)) {
8392 .int => try s.int(field_value),
8493 .pointer => |info| switch (info.size) {
lib/compiler/configurer.zig-2
......@@ -164,7 +164,6 @@ const Serialize = struct {
164164 .src_path => |src_path| i: {
165165 const sub_path = try wc.addString(src_path.sub_path);
166166 break :i try wc.addExtra(@as(Configuration.LazyPath.SourcePath, .{
167 .flags = .{},
168167 .owner = try s.builderToPackage(src_path.owner),
169168 .sub_path = sub_path,
170169 }));
......@@ -187,7 +186,6 @@ const Serialize = struct {
187186 .dependency => |dependency| i: {
188187 const sub_path = try wc.addString(dependency.sub_path);
189188 break :i try wc.addExtra(@as(Configuration.LazyPath.SourcePath, .{
190 .flags = .{},
191189 .owner = try s.builderToPackage(dependency.dependency.builder),
192190 .sub_path = sub_path,
193191 }));
lib/std/Build/Configuration.zig+4-5
......@@ -1173,7 +1173,7 @@ pub const LazyPath = union(@This().Tag) {
11731173 };
11741174
11751175 pub const SourcePath = struct {
1176 flags: @This().Flags,
1176 flags: @This().Flags = .{},
11771177 owner: Package.Index,
11781178 sub_path: String,
11791179
......@@ -2318,10 +2318,9 @@ pub const Storage = enum {
23182318
23192319 /// Valid to call only when deserializing.
23202320 pub fn tag(this: *const @This(), extra: []const u32, i: usize) Tag {
2321 _ = this;
2322 _ = extra;
2323 _ = i;
2324 @panic("TODO implement UnionList.tag");
2321 const start = @intFromPtr(this.data);
2322 const meta_start = start - (this.len * @bitSizeOf(Meta) + 31) / 32;
2323 return loadBits(u32, extra[meta_start..], i * @bitSizeOf(Meta), Meta).tag;
23252324 }
23262325
23272326 fn extraLen(len: usize) usize {