authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-23 23:51:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-23 23:51:27-07:00
log224fbb23c44628b215662c6199dff11cc2851f04
tree5358766650dcfbcc72465d86f22c9e462848a965
parent27fa4bc2bead4635038c06f8c1231cbc81674c2f

stage2: better error reporting for LazySrcLoc.entire_file

instead of crashing the compilation, uses a plain error message

1 files changed, 8 insertions(+), 0 deletions(-)

src/Compilation.zig+8
......@@ -405,6 +405,14 @@ pub const AllErrors = struct {
405405 },
406406 };
407407 }
408 if (module_err_msg.src_loc.lazy == .entire_file) {
409 try errors.append(.{
410 .plain = .{
411 .msg = try arena.allocator.dupe(u8, module_err_msg.msg),
412 },
413 });
414 return;
415 }
408416 const source = try module_err_msg.src_loc.file_scope.getSource(module.gpa);
409417 const byte_offset = try module_err_msg.src_loc.byteOffset();
410418 const loc = std.zig.findLineColumn(source, byte_offset);