zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 1b5cbf0d08d9d2fac1f17e4bcff916e4a179f080 (tree)
parent e460ba66a57f0a4e0ee07f32cef17c7f2bf290b4
Author: Jiacai Liu <dev@liujiacai.net>
Date:   Tue, 30 Jan 2024 10:43:11 +0800

fix(autodoc): avoid panic when module not found (#18699)


Diffstat:
Msrc/Autodoc.zig | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Autodoc.zig b/src/Autodoc.zig @@ -934,6 +934,8 @@ const AutodocErrors = error{ OutOfMemory, CurrentWorkingDirectoryUnlinked, UnexpectedEndOfFile, + ModuleNotFound, + ImportOutsideModulePath, } || std.fs.File.OpenError || std.fs.File.ReadError; /// `call` instructions will have loopy references to themselves @@ -1058,7 +1060,7 @@ fn walkInstruction( ); } - const new_file = self.zcu.importFile(file, path) catch unreachable; + const new_file = try self.zcu.importFile(file, path); const result = try self.files.getOrPut(self.arena, new_file.file); if (result.found_existing) { return DocData.WalkResult{