authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-07-18 18:45:07+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-07-18 18:45:07+01:00
logf5a941b3d6238222f43da568c96cfa5b3e56ce5d
tree37197f5121034108d880cff4c31c36e7608f09b6
parent3bdbf81a3f574c0cf538b443825558e45bceecee
signaturelock-open Commit is signed but in an unrecognized format.

Sema: return module-relative path for `@src()`

This is one possible approach to fixing an issue with reproducible builds where the compiler's cwd changes the paths returned by `@src()`.

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

src/Sema.zig+1-2
...@@ -17787,8 +17787,7 @@ fn zirBuiltinSrc(...@@ -17787,8 +17787,7 @@ fn zirBuiltinSrc(
17787 };17787 };
1778817788
17789 const file_name_val = v: {17789 const file_name_val = v: {
17790 // The compiler must not call realpath anywhere.17790 const file_name = fn_owner_decl.getFileScope(mod).sub_file_path;
17791 const file_name = try fn_owner_decl.getFileScope(mod).fullPath(sema.arena);
17792 const array_ty = try pt.intern(.{ .array_type = .{17791 const array_ty = try pt.intern(.{ .array_type = .{
17793 .len = file_name.len,17792 .len = file_name.len,
17794 .sentinel = .zero_u8,17793 .sentinel = .zero_u8,