authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-06-29 18:09:22+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-06-29 18:09:22+02:00
logb96882c57a20d3f9f19640dbb6b2483d7dea5dfe
tree344bd41f00e1025b1f5dd9e8f69f3bbc8926d8ff
parentbf8bf528c6c131f61de4af24c3599486a59c5868

Fix compilation errors


5 files changed, 13 insertions(+), 6 deletions(-)

lib/std/child_process.zig+1
......@@ -364,6 +364,7 @@ pub const ChildProcess = struct {
364364 error.FileTooBig => unreachable,
365365 error.DeviceBusy => unreachable,
366366 error.FileLocksNotSupported => unreachable,
367 error.NotCapable => unreachable, // until WASI comes up with multi-processing (if ever)
367368 else => |e| return e,
368369 }
369370 else
lib/std/elf.zig+1
......@@ -551,6 +551,7 @@ fn preadNoEof(file: std.fs.File, buf: []u8, offset: u64) !void {
551551 error.InputOutput => return error.FileSystem,
552552 error.Unexpected => return error.Unexpected,
553553 error.WouldBlock => return error.Unexpected,
554 error.NotCapable => unreachable, // NotCapable mainly pertains WASI target so it's a bug if we hit it here
554555 };
555556 if (len == 0) return error.UnexpectedEndOfFile;
556557 i += len;
lib/std/fs.zig+2
......@@ -1272,6 +1272,7 @@ pub const Dir = struct {
12721272 if (self.deleteFile(sub_path)) {
12731273 return;
12741274 } else |err| switch (err) {
1275 error.DirNotEmpty => unreachable,
12751276 error.FileNotFound => return,
12761277 error.IsDir => {},
12771278 error.AccessDenied => got_access_denied = true,
......@@ -1341,6 +1342,7 @@ pub const Dir = struct {
13411342
13421343 // Impossible because we do not pass any path separators.
13431344 error.NotDir => unreachable,
1345 error.DirNotEmpty => unreachable,
13441346
13451347 error.IsDir => {},
13461348 error.AccessDenied => got_access_denied = true,
lib/std/os.zig+6-6
......@@ -1589,11 +1589,11 @@ pub fn symlinkZ(target_path: [*:0]const u8, sym_link_path: [*:0]const u8) SymLin
15891589 }
15901590}
15911591
1592pub const SymlinkatError = error{
1592pub const SymLinkAtError = error{
15931593 /// WASI-only. This error occurs when the file descriptor does
15941594 /// not hold the required rights to create a new symbolic link relative to it.
15951595 NotCapable,
1596} || SymlinkError;
1596} || SymLinkError;
15971597
15981598/// Similar to `symlink`, however, creates a symbolic link named `sym_link_path` which contains the string
15991599/// `target_path` **relative** to `newdirfd` directory handle.
......@@ -1601,7 +1601,7 @@ pub const SymlinkatError = error{
16011601/// one; the latter case is known as a dangling link.
16021602/// If `sym_link_path` exists, it will not be overwritten.
16031603/// See also `symlinkatWasi`, `symlinkatZ` and `symlinkatW`.
1604pub fn symlinkat(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkatError!void {
1604pub fn symlinkat(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkAtError!void {
16051605 if (builtin.os.tag == .wasi) {
16061606 return symlinkatWasi(target_path, newdirfd, sym_link_path);
16071607 }
......@@ -1619,7 +1619,7 @@ pub const symlinkatC = @compileError("deprecated: renamed to symlinkatZ");
16191619
16201620/// WASI-only. The same as `symlinkat` but targeting WASI.
16211621/// See also `symlinkat`.
1622pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkatError!void {
1622pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkAtError!void {
16231623 switch (wasi.path_symlink(target_path.ptr, target_path.len, newdirfd, sym_link_path.ptr, sym_link_path.len)) {
16241624 wasi.ESUCCESS => {},
16251625 wasi.EFAULT => unreachable,
......@@ -1643,13 +1643,13 @@ pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []c
16431643
16441644/// Windows-only. The same as `symlinkat` except the paths are null-terminated, WTF-16 encoded.
16451645/// See also `symlinkat`.
1646pub fn symlinkatW(target_path: [*:0]const u16, newdirfd: fd_t, sym_link_path: [*:0]const u16) SymlinkatError!void {
1646pub fn symlinkatW(target_path: [*:0]const u16, newdirfd: fd_t, sym_link_path: [*:0]const u16) SymLinkAtError!void {
16471647 @compileError("TODO implement on Windows");
16481648}
16491649
16501650/// The same as `symlinkat` except the parameters are null-terminated pointers.
16511651/// See also `symlinkat`.
1652pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*:0]const u8) SymLinkatError!void {
1652pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*:0]const u8) SymLinkAtError!void {
16531653 if (builtin.os.tag == .windows) {
16541654 const target_path_w = try windows.cStrToPrefixedFileW(target_path);
16551655 const sym_link_path_w = try windows.cStrToPrefixedFileW(sym_link_path);
src-self-hosted/stage2.zig+3
......@@ -163,6 +163,7 @@ export fn stage2_render_ast(tree: *ast.Tree, output_file: *FILE) Error {
163163 error.OutOfMemory => return .OutOfMemory,
164164 error.Unexpected => return .Unexpected,
165165 error.InputOutput => return .FileSystem,
166 error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
166167 };
167168 return .None;
168169}
......@@ -606,6 +607,7 @@ export fn stage2_libc_parse(stage1_libc: *Stage2LibCInstallation, libc_file_z: [
606607 error.NotDir => return .NotDir,
607608 error.DeviceBusy => return .DeviceBusy,
608609 error.FileLocksNotSupported => unreachable,
610 error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
609611 };
610612 stage1_libc.initFromStage2(libc);
611613 return .None;
......@@ -649,6 +651,7 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:
649651 error.AccessDenied => return .AccessDenied,
650652 error.Unexpected => return .Unexpected,
651653 error.InputOutput => return .FileSystem,
654 error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
652655 };
653656 return .None;
654657}