authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-10 23:02:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-11 06:22:05-04:00
loga82d7c20631b90de2f2298d351353041ac41650d
treeea10e8411448e594c15366657a7200e9b2bcb835
parent44a6172edbf6c99f4ebfeabb530756ed2a40c3c2

std: add missing error to windows.WriteFile

I encountered this error today when testing the self-hosted compiler on Windows.

4 files changed, 10 insertions(+), 0 deletions(-)

lib/std/os.zig+4
......@@ -953,6 +953,10 @@ pub const WriteError = error{
953953 OperationAborted,
954954 NotOpenForWriting,
955955
956 /// The process cannot access the file because another process has locked
957 /// a portion of the file. Windows-only.
958 LockViolation,
959
956960 /// This error occurs when no global event loop is configured,
957961 /// and reading from the file descriptor would block.
958962 WouldBlock,
lib/std/os/windows.zig+4
......@@ -517,6 +517,9 @@ pub const WriteFileError = error{
517517 OperationAborted,
518518 BrokenPipe,
519519 NotOpenForWriting,
520 /// The process cannot access the file because another process has locked
521 /// a portion of the file.
522 LockViolation,
520523 Unexpected,
521524};
522525
......@@ -597,6 +600,7 @@ pub fn WriteFile(
597600 .IO_PENDING => unreachable,
598601 .BROKEN_PIPE => return error.BrokenPipe,
599602 .INVALID_HANDLE => return error.NotOpenForWriting,
603 .LOCK_VIOLATION => return error.LockViolation,
600604 else => |err| return unexpectedError(err),
601605 }
602606 }
src/link.zig+1
......@@ -435,6 +435,7 @@ pub const File = struct {
435435 EmitFail,
436436 NameTooLong,
437437 CurrentWorkingDirectoryUnlinked,
438 LockViolation,
438439 };
439440
440441 /// Called from within the CodeGen to lower a local variable instantion as an unnamed
src/main.zig+1
......@@ -4227,6 +4227,7 @@ const FmtError = error{
42274227 NotOpenForWriting,
42284228 UnsupportedEncoding,
42294229 ConnectionResetByPeer,
4230 LockViolation,
42304231} || fs.File.OpenError;
42314232
42324233fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) FmtError!void {