Commit b96882c57a

Jakub Konka <kubkon@jakubkonka.com>
2020-06-29 18:09:22
Fix compilation errors
1 parent bf8bf52
Changed files (5)
lib/std/child_process.zig
@@ -364,6 +364,7 @@ pub const ChildProcess = struct {
                 error.FileTooBig => unreachable,
                 error.DeviceBusy => unreachable,
                 error.FileLocksNotSupported => unreachable,
+                error.NotCapable => unreachable, // until WASI comes up with multi-processing (if ever)
                 else => |e| return e,
             }
         else
lib/std/elf.zig
@@ -551,6 +551,7 @@ fn preadNoEof(file: std.fs.File, buf: []u8, offset: u64) !void {
             error.InputOutput => return error.FileSystem,
             error.Unexpected => return error.Unexpected,
             error.WouldBlock => return error.Unexpected,
+            error.NotCapable => unreachable, // NotCapable mainly pertains WASI target so it's a bug if we hit it here
         };
         if (len == 0) return error.UnexpectedEndOfFile;
         i += len;
lib/std/fs.zig
@@ -1272,6 +1272,7 @@ pub const Dir = struct {
             if (self.deleteFile(sub_path)) {
                 return;
             } else |err| switch (err) {
+                error.DirNotEmpty => unreachable,
                 error.FileNotFound => return,
                 error.IsDir => {},
                 error.AccessDenied => got_access_denied = true,
@@ -1341,6 +1342,7 @@ pub const Dir = struct {
 
                         // Impossible because we do not pass any path separators.
                         error.NotDir => unreachable,
+                        error.DirNotEmpty => unreachable,
 
                         error.IsDir => {},
                         error.AccessDenied => got_access_denied = true,
lib/std/os.zig
@@ -1589,11 +1589,11 @@ pub fn symlinkZ(target_path: [*:0]const u8, sym_link_path: [*:0]const u8) SymLin
     }
 }
 
-pub const SymlinkatError = error{
+pub const SymLinkAtError = error{
     /// WASI-only. This error occurs when the file descriptor does
     /// not hold the required rights to create a new symbolic link relative to it.
     NotCapable,
-} || SymlinkError;
+} || SymLinkError;
 
 /// Similar to `symlink`, however, creates a symbolic link named `sym_link_path` which contains the string
 /// `target_path` **relative** to `newdirfd` directory handle.
@@ -1601,7 +1601,7 @@ pub const SymlinkatError = error{
 /// one; the latter case is known as a dangling link.
 /// If `sym_link_path` exists, it will not be overwritten.
 /// See also `symlinkatWasi`, `symlinkatZ` and `symlinkatW`.
-pub fn symlinkat(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkatError!void {
+pub fn symlinkat(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkAtError!void {
     if (builtin.os.tag == .wasi) {
         return symlinkatWasi(target_path, newdirfd, sym_link_path);
     }
@@ -1619,7 +1619,7 @@ pub const symlinkatC = @compileError("deprecated: renamed to symlinkatZ");
 
 /// WASI-only. The same as `symlinkat` but targeting WASI.
 /// See also `symlinkat`.
-pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkatError!void {
+pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkAtError!void {
     switch (wasi.path_symlink(target_path.ptr, target_path.len, newdirfd, sym_link_path.ptr, sym_link_path.len)) {
         wasi.ESUCCESS => {},
         wasi.EFAULT => unreachable,
@@ -1643,13 +1643,13 @@ pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []c
 
 /// Windows-only. The same as `symlinkat` except the paths are null-terminated, WTF-16 encoded.
 /// See also `symlinkat`.
-pub fn symlinkatW(target_path: [*:0]const u16, newdirfd: fd_t, sym_link_path: [*:0]const u16) SymlinkatError!void {
+pub fn symlinkatW(target_path: [*:0]const u16, newdirfd: fd_t, sym_link_path: [*:0]const u16) SymLinkAtError!void {
     @compileError("TODO implement on Windows");
 }
 
 /// The same as `symlinkat` except the parameters are null-terminated pointers.
 /// See also `symlinkat`.
-pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*:0]const u8) SymLinkatError!void {
+pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*:0]const u8) SymLinkAtError!void {
     if (builtin.os.tag == .windows) {
         const target_path_w = try windows.cStrToPrefixedFileW(target_path);
         const sym_link_path_w = try windows.cStrToPrefixedFileW(sym_link_path);
src-self-hosted/stage2.zig
@@ -163,6 +163,7 @@ export fn stage2_render_ast(tree: *ast.Tree, output_file: *FILE) Error {
         error.OutOfMemory => return .OutOfMemory,
         error.Unexpected => return .Unexpected,
         error.InputOutput => return .FileSystem,
+        error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
     };
     return .None;
 }
@@ -606,6 +607,7 @@ export fn stage2_libc_parse(stage1_libc: *Stage2LibCInstallation, libc_file_z: [
         error.NotDir => return .NotDir,
         error.DeviceBusy => return .DeviceBusy,
         error.FileLocksNotSupported => unreachable,
+        error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
     };
     stage1_libc.initFromStage2(libc);
     return .None;
@@ -649,6 +651,7 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:
         error.AccessDenied => return .AccessDenied,
         error.Unexpected => return .Unexpected,
         error.InputOutput => return .FileSystem,
+        error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
     };
     return .None;
 }