authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-27 17:28:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-27 17:30:29-07:00
log6d47b4f39e8cdd95ead71b1efdbf67a737174e97
tree4136cd37830bba4f946c8a121ba4e5ed2eba74ab
parent15a030ef3d2d68992835568f2fb9d5deab18f39f

Revert "Include package root dir in stage2 error messages"

This reverts commit 15a030ef3d2d68992835568f2fb9d5deab18f39f. ast-check started crashing after this commit. Needs more QA before merging.

2 files changed, 6 insertions(+), 10 deletions(-)

src/Compilation.zig+6-6
......@@ -403,10 +403,10 @@ pub const AllErrors = struct {
403403 const source = try module_note.src_loc.file_scope.getSource(module.gpa);
404404 const byte_offset = try module_note.src_loc.byteOffset(module.gpa);
405405 const loc = std.zig.findLineColumn(source, byte_offset);
406 const file_path = try module_note.src_loc.file_scope.fullPath(&arena.allocator);
406 const sub_file_path = module_note.src_loc.file_scope.sub_file_path;
407407 note.* = .{
408408 .src = .{
409 .src_path = file_path,
409 .src_path = try arena.allocator.dupe(u8, sub_file_path),
410410 .msg = try arena.allocator.dupe(u8, module_note.msg),
411411 .byte_offset = byte_offset,
412412 .line = @intCast(u32, loc.line),
......@@ -426,10 +426,10 @@ pub const AllErrors = struct {
426426 const source = try module_err_msg.src_loc.file_scope.getSource(module.gpa);
427427 const byte_offset = try module_err_msg.src_loc.byteOffset(module.gpa);
428428 const loc = std.zig.findLineColumn(source, byte_offset);
429 const file_path = try module_err_msg.src_loc.file_scope.fullPath(&arena.allocator);
429 const sub_file_path = module_err_msg.src_loc.file_scope.sub_file_path;
430430 try errors.append(.{
431431 .src = .{
432 .src_path = file_path,
432 .src_path = try arena.allocator.dupe(u8, sub_file_path),
433433 .msg = try arena.allocator.dupe(u8, module_err_msg.msg),
434434 .byte_offset = byte_offset,
435435 .line = @intCast(u32, loc.line),
......@@ -480,7 +480,7 @@ pub const AllErrors = struct {
480480
481481 note.* = .{
482482 .src = .{
483 .src_path = try file.fullPath(arena),
483 .src_path = try arena.dupe(u8, file.sub_file_path),
484484 .msg = try arena.dupe(u8, msg),
485485 .byte_offset = byte_offset,
486486 .line = @intCast(u32, loc.line),
......@@ -506,7 +506,7 @@ pub const AllErrors = struct {
506506
507507 try errors.append(.{
508508 .src = .{
509 .src_path = try file.fullPath(arena),
509 .src_path = try arena.dupe(u8, file.sub_file_path),
510510 .msg = try arena.dupe(u8, msg),
511511 .byte_offset = byte_offset,
512512 .line = @intCast(u32, loc.line),
src/Module.zig-4
......@@ -1111,10 +1111,6 @@ pub const Scope = struct {
11111111 return buf.toOwnedSliceSentinel(0);
11121112 }
11131113
1114 pub fn fullPath(file: File, ally: *Allocator) ![]u8 {
1115 return file.pkg.root_src_directory.join(ally, &[_][]const u8{file.sub_file_path});
1116 }
1117
11181114 pub fn dumpSrc(file: *File, src: LazySrcLoc) void {
11191115 const loc = std.zig.findLineColumn(file.source.bytes, src);
11201116 std.debug.print("{s}:{d}:{d}\n", .{ file.sub_file_path, loc.line + 1, loc.column + 1 });