Skip to content

Commit

Permalink
more rustfmt? anyway ci, speak to me of the macos assert fail
Browse files Browse the repository at this point in the history
  • Loading branch information
iximeow committed Dec 30, 2019
1 parent a310f9f commit 47f7cc0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion crates/wasi-common/src/sys/windows/fdentry_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ impl AsRawHandle for Descriptor {
fn as_raw_handle(&self) -> RawHandle {
match self {
Self::File(fdentry::File::OsHandle(file)) => file.as_raw_handle(),
Self::File(fdentry::File::VirtualFile(_file)) => { unimplemented!("virtual as_raw_handle"); },
Self::File(fdentry::File::VirtualFile(_file)) => {
unimplemented!("virtual as_raw_handle");
}
Self::Stdin => io::stdin().as_raw_handle(),
Self::Stdout => io::stdout().as_raw_handle(),
Self::Stderr => io::stderr().as_raw_handle(),
Expand Down
23 changes: 15 additions & 8 deletions crates/wasi-common/src/sys/windows/hostcalls_impl/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ pub(crate) fn path_readlink(resolved: PathGet, buf: &mut [u8]) -> Result<usize>
} else {
Ok(0)
}
},
}
fdentry::File::VirtualFile(_) => {
unimplemented!("virtual readlink");
}
Expand Down Expand Up @@ -436,7 +436,9 @@ pub(crate) fn path_rename(resolved_old: PathGet, resolved_new: PathGet) -> Resul
WinError::ERROR_INVALID_NAME => {
// If source contains trailing slashes, check if we are dealing with
// a file instead of a dir, and if so, throw ENOTDIR.
if let Some(path) = strip_trailing_slashes_and_concatenate(&resolved_old)? {
if let Some(path) =
strip_trailing_slashes_and_concatenate(&resolved_old)?
{
if path.is_file() {
return Err(Error::ENOTDIR);
}
Expand All @@ -451,7 +453,7 @@ pub(crate) fn path_rename(resolved_old: PathGet, resolved_new: PathGet) -> Resul
Err(Error::EIO)
}
})
},
}
_ => {
unimplemented!("path_rename with one or more virtual files");
}
Expand Down Expand Up @@ -530,10 +532,13 @@ pub(crate) fn path_filestat_set_times(
.open(path)?;
let modifiable_fd = fdentry::File::OsHandle(OsHandle::from(file));
fd_filestat_set_times_impl(&modifiable_fd, st_atim, st_mtim, fst_flags)
},
fdentry::File::VirtualFile(_) => {
fd_filestat_set_times_impl(&resolved.open_with(false, true, 0, 0)?, st_atim, st_mtim, fst_flags)
}
fdentry::File::VirtualFile(_) => fd_filestat_set_times_impl(
&resolved.open_with(false, true, 0, 0)?,
st_atim,
st_mtim,
fst_flags,
),
}
}

Expand Down Expand Up @@ -566,7 +571,9 @@ pub(crate) fn path_symlink(old_path: &str, resolved: PathGet) -> Result<()> {
}
WinError::ERROR_INVALID_NAME => {
// does the target without trailing slashes exist?
if let Some(path) = strip_trailing_slashes_and_concatenate(&resolved)? {
if let Some(path) =
strip_trailing_slashes_and_concatenate(&resolved)?
{
if path.exists() {
return Err(Error::EEXIST);
}
Expand All @@ -582,7 +589,7 @@ pub(crate) fn path_symlink(old_path: &str, resolved: PathGet) -> Result<()> {
}
}
})
},
}
fdentry::File::VirtualFile(virt) => {
unimplemented!("virtual path_symlink");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ pub(crate) trait PathGetExt {
impl PathGetExt for PathGet {
fn concatenate(&self) -> Result<PathBuf> {
match self.dirfd() {
fdentry::File::OsHandle(file) => {
concatenate(file, Path::new(self.path()))
}
fdentry::File::OsHandle(file) => concatenate(file, Path::new(self.path())),
fdentry::File::VirtualFile(_virt) => {
panic!("concatenate on a virtual base");
}
Expand Down

0 comments on commit 47f7cc0

Please sign in to comment.