Zig Version
0.17.0-dev.298+ad1b746e2
Steps to Reproduce and Observed Behavior
I haven't worked out a smaller repro, so let's just use ZLS.
We'll be editing github.com/zigtools/zls@f0bb3d2780/src/Server.zig (L1608)
Run zig build -fincremental --watch in the project's dir.
Change the name of the union(enum), eg delete the first char ('H').
Save.
Build Summary: 10/10 steps succeeded
install
└─ install zls
└─ compile exe zls Debug native 2 errors
src/Server.zig:1621:51: error: use of undeclared identifier 'HandledNotificationParams'
const Message = lsp.Message(HandledRequestParams, HandledNotificationParams, .{});
^~~~~~~~~~~~~~~~~~~~~~~~~
src/Server.zig:1830:33: error: use of undeclared identifier 'HandledNotificationParams'
const Params = std.meta.Tag(HandledNotificationParams);
^~~~~~~~~~~~~~~~~~~~~~~~~
error: 2 compilation errors
Undo the change. Save.
Build Summary: 7/10 steps succeeded (1 failed)
install
└─ install zls
└─ compile exe zls Debug native failure
error: referenced transitive analysis errors, but none actually emitted
func('Server.loop' [32750]) [transitive failure]
referenced by: func('main.main' [31321])
referenced by: func('start.posixCallMainAndExit' [31201])
referenced by: func('start._start' [31186])
referenced by: comptime(inst=('/home/rad/lab/zig/build/stage4/lib/std/start.zig', %50) [3])
referenced by: nav_val('std.start' [89])
referenced by: comptime(inst=('/home/rad/lab/zig/build/stage4/lib/std/std.zig', %554) [0])
thread 114625 panic: referenced transitive analysis errors, but none actually emitted
Cannot print stack trace: stack tracing is disabled
error: process terminated with signal ABRT
P.S. I tried using a debug build of the compiler to get more info, but it panics in Elf2.zig
~/lab/zig/build/stage5/bin/zig build check -fincremental --watch
check
└─ compile exe zls Debug native
└─ run exe zls_gen (version_data.zig)
└─ compile exe zls_gen Debug native failure
error: Compiler crash context:
(no context)
thread 114849 panic: reached unreachable code
/home/rad/lab/zig/build/stage3/lib/zig/std/debug.zig:423:14: 0x1753109 in assert (std.zig)
if (!ok) unreachable; // assertion failure
^
/home/rad/lab/zig/src/link/Elf2.zig:1640:11: 0x2486c9a in initHeaders (main.zig)
assert(elf.nodes.len == expected_nodes_len);
^
/home/rad/lab/zig/src/link/Elf2.zig:1046:24: 0x248a537 in create (main.zig)
try elf.initHeaders(class, data, osabi, @"type", machine, maybe_interp);
^
/home/rad/lab/zig/src/link/Elf2.zig:915:18: 0x249f160 in open (main.zig)
return create(arena, comp, path, options);
^
/home/rad/lab/zig/src/link.zig:548:48: 0x249fb8c in open (main.zig)
const ptr = try tag.Type().open(arena, comp, emit, options);
^
/home/rad/lab/zig/src/Compilation.zig:2454:51: 0x6091cbc in create (main.zig)
comp.bin_file = link.File.open(arena, comp, emit, lf_open_opts) catch |err| {
^
/home/rad/lab/zig/src/main.zig:3554:36: 0x1a2f11e in buildOutputType (main.zig)
const comp = Compilation.create(gpa, arena, io, &create_diag, .{
^
/home/rad/lab/zig/src/main.zig:283:31: 0x1a7d1f7 in mainArgs (main.zig)
return buildOutputType(gpa, arena, io, args, .{ .build = .Exe }, environ_map);
^
/home/rad/lab/zig/src/main.zig:236:20: 0x19d6941 in main (main.zig)
return mainArgs(gpa, arena, io, args, &environ_map);
^
/home/rad/lab/zig/build/stage3/lib/zig/std/start.zig:712:88: 0x19d5480 in callMain (std.zig)
if (fn_info.params[0].type.? == std.process.Init.Minimal) return wrapMain(root.main(.{
^
/home/rad/lab/zig/build/stage3/lib/zig/std/start.zig:203:5: 0x19d4e51 in _start (std.zig)
asm volatile (switch (native_arch) {
^
failed command: /home/rad/lab/zig/build/stage5/bin/zig build-exe -fsingle-threaded -Mroot=/home/rad/lab/zls/src/tools/config_gen.zig --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name zls_gen --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=-
check
└─ compile exe zls Debug native
└─ run exe lsp-codegen (lsp_types.zig)
└─ compile exe lsp-codegen Debug native failure
error: Compiler crash context:
(no context)
thread 114850 panic: reached unreachable codethread
/home/rad/lab/zig/build/stage3/lib/zig/std/debug.zig:423:14: 0x1753109 in assert (std.zig)
if (!ok) unreachable; // assertion failure
^
/home/rad/lab/zig/src/link/Elf2.zig:1640:11: 0x2486c9a in initHeaders (main.zig)114845 panic: attempt to use null value
assert(elf.nodes.len == expected_nodes_len);
^
/home/rad/lab/zig/src/link/Elf2.zig:1046:24: 0x248a537 in create (main.zig)
try elf.initHeaders(class, data, osabi, @"type", machine, maybe_interp);
^
/home/rad/lab/zig/src/link/Elf2.zig:915:18: 0x249f160 in open (main.zig)
return create(arena, comp, path, options);
^
/home/rad/lab/zig/src/link.zig:548:48: 0x249fb8c in open (main.zig)
const ptr = try tag.Type().open(arena, comp, emit, options);
^
/home/rad/lab/zig/src/Compilation.zig:2454:51: 0x6091cbc in create (main.zig)
comp.bin_file = link.File.open(arena, comp, emit, lf_open_opts) catch |err| {
^
/home/rad/lab/zig/src/main.zig:3554:36: 0x1a2f11e in buildOutputType (main.zig)
const comp = Compilation.create(gpa, arena, io, &create_diag, .{
^
/home/rad/lab/zig/src/main.zig:283:31: 0x1a7d1f7 in mainArgs (main.zig)
return buildOutputType(gpa, arena, io, args, .{ .build = .Exe }, environ_map);
^
/home/rad/lab/zig/src/main.zig:236:20: 0x19d6941 in main (main.zig)
return mainArgs(gpa, arena, io, args, &environ_map);
^
/home/rad/lab/zig/build/stage3/lib/zig/std/start.zig:712:88: 0x19d5480 in callMain (std.zig)
if (fn_info.params[0].type.? == std.process.Init.Minimal) return wrapMain(root.main(.{
^
/home/rad/lab/zig/build/stage3/lib/zig/std/start.zig:203:5: 0x19d4e51 in _start (std.zig)
asm volatile (switch (native_arch) {
^
failed command: /home/rad/lab/zig/build/stage5/bin/zig build-exe -fsingle-threaded --dep meta-model -Mroot=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/src/codegen/codegen.zig -Mmeta-model=/home/rad/lab/zls/zig-pkg/lsp_kit-0.1.0-bi_PL3IyDACfp1xdTnkiOHEok2YpPCCCJHuuOcNzjl1D/metaModel.json --cache-dir .zig-cache --global-cache-dir /home/rad/.cache/zig --name lsp-codegen --zig-lib-dir /home/rad/lab/zig/lib/ -fincremental --listen=-
/home/rad/lab/zig/lib/std/Build/Step/Run.zig:869:95: 0x157ba4d in make (std.zig)
const file_path = artifact.installed_path orelse artifact.generated_bin.?.path.?;
^
/home/rad/lab/zig/lib/std/Build/Step.zig:276:33: 0x148b92f in make (std.zig)
const make_result = s.makeFn(s, options);
^
/home/rad/lab/zig/lib/compiler/build_runner.zig:1343:26: 0x1489f7e in makeStep (build_runner.zig)
} else if (s.make(.{
^
/home/rad/lab/zig/lib/std/Io.zig:1257:17: 0x1489ba5 in start (std.zig)
_ = @as(Cancelable!void, @call(.auto, function, args_casted.*)) catch {};
^
/home/rad/lab/zig/lib/std/Io/Threaded.zig:552:22: 0x1243725 in start (std.zig)
task.func(task.contextPointer());
^
/home/rad/lab/zig/lib/std/Io/Threaded.zig:1797:29: 0x1241924 in worker (std.zig)
runnable.startFn(runnable, &thread, t);
^
/home/rad/lab/zig/lib/std/Thread.zig:422:13: 0x1241605 in callFn__anon_27785 (std.zig)
@call(.auto, f, args);
^
/home/rad/lab/zig/lib/std/Thread.zig:1434:30: 0x12413c0 in entryFn (std.zig)
return callFn(f, self.fn_args);
^
/home/rad/lab/zig/lib/std/os/linux/x86_64.zig:134:5: 0x1241525 in clone (std.zig)
asm volatile (
^
thread 114848 panic: attempt to use null value
/home/rad/lab/zig/lib/std/Build/Step/Run.zig:869:95: 0x157ba4d in make (std.zig)
const file_path = artifact.installed_path orelse artifact.generated_bin.?.path.?;
^
/home/rad/lab/zig/lib/std/Build/Step.zig:276:33: 0x148b92f in make (std.zig)
const make_result = s.makeFn(s, options);
^
/home/rad/lab/zig/lib/compiler/build_runner.zig:1343:26: 0x1489f7e in makeStep (build_runner.zig)
} else if (s.make(.{
^
/home/rad/lab/zig/lib/std/Io.zig:1257:17: 0x1489ba5 in start (std.zig)
_ = @as(Cancelable!void, @call(.auto, function, args_casted.*)) catch {};
^
/home/rad/lab/zig/lib/std/Io/Threaded.zig:552:22: 0x1243725 in start (std.zig)
task.func(task.contextPointer());
^
/home/rad/lab/zig/lib/std/Io/Threaded.zig:1797:29: 0x1241924 in worker (std.zig)
runnable.startFn(runnable, &thread, t);
^
/home/rad/lab/zig/lib/std/Thread.zig:422:13: 0x1241605 in callFn__anon_27785 (std.zig)
@call(.auto, f, args);
^
/home/rad/lab/zig/lib/std/Thread.zig:1434:30: 0x12413c0 in entryFn (std.zig)
return callFn(f, self.fn_args);
^
/home/rad/lab/zig/lib/std/os/linux/x86_64.zig:134:5: 0x1241525 in clone (std.zig)
asm volatile (
^
error: the following build command terminated with signal ABRT:
.zig-cache/o/7e2697b73523257f5034997065048d17/build /home/rad/lab/zig/build/stage5/bin/zig /home/rad/lab/zig/lib /home/rad/lab/zls .zig-cache /home/rad/.cache/zig --seed 0x2969797c -Z55b30264036b2591 check -fincremental --watch