| author | |
| committer | |
| log | 29b7214027b0c9bddc4c67587ee75b4adcdab4f8 |
| tree | 96db647c5d95cf56fbd3d599a071ada0141740b8 |
| parent | 3729a53eec1951376c01c7e799b439b1a84694b5 |
This error is actually only ever directly returned from `std.posix.getcwd` (and only on POSIX systems, so never on Windows). Its inclusion in almost all of the error sets its currently found in is a leftover from when `std.fs.path.resolve` called `std.process.getCwdAlloc` (https://github.com/ziglang/zig/issues/13613).6 files changed, 5 insertions(+), 12 deletions(-)
lib/std/posix.zig+1| ... | ... | @@ -521,6 +521,7 @@ pub fn getppid() pid_t { |
| 521 | 521 | |
| 522 | 522 | pub const GetCwdError = error{ |
| 523 | 523 | NameTooLong, |
| 524 | /// Not possible on Windows. | |
| 524 | 525 | CurrentWorkingDirectoryUnlinked, |
| 525 | 526 | } || UnexpectedError; |
| 526 | 527 |
lib/std/process.zig+4-3| ... | ... | @@ -73,7 +73,10 @@ pub fn getCwd(out_buffer: []u8) GetCwdError![]u8 { |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Same as GetCwdError, minus error.NameTooLong + Allocator.Error |
| 76 | pub const GetCwdAllocError = Allocator.Error || error{CurrentWorkingDirectoryUnlinked} || posix.UnexpectedError; | |
| 76 | pub const GetCwdAllocError = Allocator.Error || error{ | |
| 77 | /// Not possible on Windows. | |
| 78 | CurrentWorkingDirectoryUnlinked, | |
| 79 | } || posix.UnexpectedError; | |
| 77 | 80 | |
| 78 | 81 | /// Caller must free the returned memory. |
| 79 | 82 | /// On Windows, the result is encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| ... | ... | @@ -342,8 +345,6 @@ pub const SpawnError = error{ |
| 342 | 345 | /// Windows-only. `cwd` or `argv` was provided and it was invalid WTF-8. |
| 343 | 346 | /// https://wtf-8.codeberg.page/ |
| 344 | 347 | InvalidWtf8, |
| 345 | /// Windows-only. `cwd` was provided, but the path did not exist when spawning the child process. | |
| 346 | CurrentWorkingDirectoryUnlinked, | |
| 347 | 348 | /// Windows-only. NUL (U+0000), LF (U+000A), CR (U+000D) are not allowed |
| 348 | 349 | /// within arguments when executing a `.bat`/`.cmd` script. |
| 349 | 350 | /// - NUL/LF signifiies end of arguments, so anything afterwards |
lib/std/zig/system.zig-1| ... | ... | @@ -504,7 +504,6 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { |
| 504 | 504 | if (builtin.os.tag == .linux and result.isBionicLibC() and query.os_tag == null and query.android_api_level == null) { |
| 505 | 505 | result.os.version_range.linux.android = detectAndroidApiLevel(io) catch |err| return switch (err) { |
| 506 | 506 | error.InvalidWtf8, |
| 507 | error.CurrentWorkingDirectoryUnlinked, | |
| 508 | 507 | error.InvalidBatchScriptArg, |
| 509 | 508 | => unreachable, // Windows-only |
| 510 | 509 | error.ApiLevelQueryFailed => |e| e, |
src/Compilation.zig-3| ... | ... | @@ -1851,7 +1851,6 @@ fn addModuleTableToCacheHash( |
| 1851 | 1851 | ) error{ |
| 1852 | 1852 | OutOfMemory, |
| 1853 | 1853 | Unexpected, |
| 1854 | CurrentWorkingDirectoryUnlinked, | |
| 1855 | 1854 | }!void { |
| 1856 | 1855 | assert(zcu.module_roots.count() != 0); // module_roots is populated |
| 1857 | 1856 | |
| ... | ... | @@ -1919,7 +1918,6 @@ pub const CreateError = error{ |
| 1919 | 1918 | OutOfMemory, |
| 1920 | 1919 | Canceled, |
| 1921 | 1920 | Unexpected, |
| 1922 | CurrentWorkingDirectoryUnlinked, | |
| 1923 | 1921 | /// An error has been stored to `diag`. |
| 1924 | 1922 | CreateFail, |
| 1925 | 1923 | }; |
| ... | ... | @@ -2906,7 +2904,6 @@ pub const UpdateError = error{ |
| 2906 | 2904 | OutOfMemory, |
| 2907 | 2905 | Canceled, |
| 2908 | 2906 | Unexpected, |
| 2909 | CurrentWorkingDirectoryUnlinked, | |
| 2910 | 2907 | }; |
| 2911 | 2908 | |
| 2912 | 2909 | /// Detect changes to source files, perform semantic analysis, and update the output files. |
src/Sema.zig-4| ... | ... | @@ -13604,10 +13604,6 @@ fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 13604 | 13604 | error.ImportOutsideModulePath => { |
| 13605 | 13605 | return sema.fail(block, operand_src, "embed of file outside package path: '{s}'", .{name}); |
| 13606 | 13606 | }, |
| 13607 | error.CurrentWorkingDirectoryUnlinked => { | |
| 13608 | // TODO: this should be some kind of retryable failure, in case the cwd is put back | |
| 13609 | return sema.fail(block, operand_src, "unable to resolve '{s}': working directory has been unlinked", .{name}); | |
| 13610 | }, | |
| 13611 | 13607 | error.OutOfMemory => |e| return e, |
| 13612 | 13608 | error.Canceled => |e| return e, |
| 13613 | 13609 | }; |
src/Zcu/PerThread.zig-1| ... | ... | @@ -2388,7 +2388,6 @@ pub fn embedFile( |
| 2388 | 2388 | OutOfMemory, |
| 2389 | 2389 | Canceled, |
| 2390 | 2390 | ImportOutsideModulePath, |
| 2391 | CurrentWorkingDirectoryUnlinked, | |
| 2392 | 2391 | }!Zcu.EmbedFile.Index { |
| 2393 | 2392 | const zcu = pt.zcu; |
| 2394 | 2393 | const gpa = zcu.gpa; |