authorgravatar for wxsychi@163.comriChar <wxsychi@163.com> 2022-09-02 17:53:48+08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-09-02 12:53:48+03:00
logf7784a081fb399025b579ee7e1337a414af16d49
treeaef8a644716ad7a380a12ef98bf93cda05412c5e
parent0d96f1f4fb3b217e11253c33e71973c3cbfb2f96
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

stage2: fix panic when the dependency is missing


2 files changed, 17 insertions(+), 1 deletions(-)

src/Sema.zig+3-1
......@@ -10379,7 +10379,9 @@ fn zirImport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1037910379 }
1038010380 }
1038110381 unreachable;
10382 } else unreachable;
10382 } else {
10383 return sema.fail(block, operand_src, "no package named '{s}' available", .{operand});
10384 };
1038310385 return sema.fail(block, operand_src, "no package named '{s}' available within package '{s}'", .{ operand, parent });
1038410386 },
1038510387 else => {
src/main.zig+14
......@@ -2750,8 +2750,22 @@ fn buildOutputType(
27502750
27512751 // Transfer packages added with --pkg-begin/--pkg-end to the root package
27522752 if (main_pkg) |pkg| {
2753 var it = pkg_tree_root.table.valueIterator();
2754 while (it.next()) |p| {
2755 if (p.*.parent == &pkg_tree_root) {
2756 p.*.parent = pkg;
2757 }
2758 }
27532759 pkg.table = pkg_tree_root.table;
27542760 pkg_tree_root.table = .{};
2761 } else {
2762 // Remove any dangling pointers just in case.
2763 var it = pkg_tree_root.table.valueIterator();
2764 while (it.next()) |p| {
2765 if (p.*.parent == &pkg_tree_root) {
2766 p.*.parent = null;
2767 }
2768 }
27552769 }
27562770
27572771 const self_exe_path = try introspect.findZigExePath(arena);