mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
stage2: better error reporting for LazySrcLoc.entire_file
instead of crashing the compilation, uses a plain error message
This commit is contained in:
parent
27fa4bc2be
commit
224fbb23c4
@ -405,6 +405,14 @@ pub const AllErrors = struct {
|
||||
},
|
||||
};
|
||||
}
|
||||
if (module_err_msg.src_loc.lazy == .entire_file) {
|
||||
try errors.append(.{
|
||||
.plain = .{
|
||||
.msg = try arena.allocator.dupe(u8, module_err_msg.msg),
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const source = try module_err_msg.src_loc.file_scope.getSource(module.gpa);
|
||||
const byte_offset = try module_err_msg.src_loc.byteOffset();
|
||||
const loc = std.zig.findLineColumn(source, byte_offset);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user