Skip to content

Commit

Permalink
Merge #2701
Browse files Browse the repository at this point in the history
2701: Last improvements r=syrusakbary a=syrusakbary

This PR:
* [x] Updates dependencies removing some unused crates
* [x] Adds an API for allowing interacting with the filesystem easily from JS


Co-authored-by: Syrus Akbary <[email protected]>
  • Loading branch information
bors[bot] and syrusakbary authored Nov 30, 2021
2 parents 9797775 + 5b78193 commit 370aba0
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 241 deletions.
468 changes: 239 additions & 229 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ loupe = "0.1"
# For logging tests using the `RUST_LOG=debug` when testing
test-env-log = { version = "0.2", default-features = false, features = ["trace"] }
tracing = { version = "0.1", default-features = false, features = ["log"] }
tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "fmt"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] }

[features]
# Don't add the compiler features in default, please add them on the Makefile
Expand Down
6 changes: 3 additions & 3 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ deny = [
skip = [
{ name = "ahash", version = "=0.4.7" },
{ name = "hashbrown", version = "=0.9.1" },
{ name = "cfg-if", version = "0.1.10" },
{ name = "cfg-if", version = "=0.1.10" },
{ name = "gimli", version = "=0.25.0" },
{ name = "strsim", version = "=0.8.0" },
{ name = "semver", version = "=0.11.0" },
{ name = "semver", version = "=0.9.0" },
{ name = "semver", version = "=0.11.0" },
{ name = "semver-parser", version = "=0.7.0" },
{ name = "rustc_version", version = "=0.2.3" },
{ name = "itertools", version = "0.9.0" },
]
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler-llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ wasmer-vm = { path = "../vm", version = "2.0.0" }
wasmer-types = { path = "../types", version = "2.0.0" }
target-lexicon = { version = "0.12.2", default-features = false }
smallvec = "1.6"
object = { version = "0.26", default-features = false, features = ["read"] }
object = { version = "0.27", default-features = false, features = ["read"] }
libc = { version = "^0.2", default-features = false }
byteorder = "1"
itertools = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion lib/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ target-lexicon = { version = "0.12.2", default-features = false }
# flexbuffers = { path = "../../../flatbuffers/rust/flexbuffers", version = "0.1.0" }
backtrace = "0.3"
rustc-demangle = "0.1"
memmap2 = "0.2.0"
memmap2 = "0.5"
more-asserts = "0.2"
thiserror = "1.0"
serde = { version = "1.0", features = ["derive", "rc"] }
Expand Down
2 changes: 1 addition & 1 deletion lib/object/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ wasmer-compiler = { path = "../compiler", version = "2.0.0", default-features =
"std",
"translator"
] }
object = { version = "0.26", default-features = false, features = ["write"] }
object = { version = "0.27", default-features = false, features = ["write"] }
thiserror = "1.0"
13 changes: 12 additions & 1 deletion lib/vfs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub type Result<T> = std::result::Result<T, FsError>;
#[repr(transparent)]
pub struct FileDescriptor(usize);

pub trait FileSystem: fmt::Debug + Send + Sync + 'static {
pub trait FileSystem: fmt::Debug + Send + Sync + 'static + Upcastable {
fn read_dir(&self, path: &Path) -> Result<ReadDir>;
fn create_dir(&self, path: &Path) -> Result<()>;
fn remove_dir(&self, path: &Path) -> Result<()>;
Expand All @@ -39,6 +39,17 @@ pub trait FileSystem: fmt::Debug + Send + Sync + 'static {
fn new_open_options(&self) -> OpenOptions;
}

impl dyn FileSystem + 'static {
#[inline]
pub fn downcast_ref<T: 'static>(&'_ self) -> Option<&'_ T> {
self.upcast_any_ref().downcast_ref::<T>()
}
#[inline]
pub fn downcast_mut<T: 'static>(&'_ mut self) -> Option<&'_ mut T> {
self.upcast_any_mut().downcast_mut::<T>()
}
}

pub trait FileOpener {
fn open(&mut self, path: &Path, conf: &OpenOptionsConfig) -> Result<Box<dyn VirtualFile>>;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub struct WasiFs {
/// for fds still open after the file has been deleted
pub orphan_fds: HashMap<Inode, InodeVal>,
#[cfg_attr(feature = "enable-serde", serde(skip, default = "default_fs_backing"))]
fs_backing: Box<dyn FileSystem>,
pub fs_backing: Box<dyn FileSystem>,
}

/// Returns the default filesystem backing
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/compiler-test-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ syn = { version = "1.*", features = ["full"] }
[features]

[dev-dependencies]
pretty_assertions = "0.6.1"
pretty_assertions = "1.0"
trybuild = "1.0.11"
2 changes: 1 addition & 1 deletion tests/lib/wast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ anyhow = "1.0"
wasmer = { path = "../../../lib/api", version = "2.0.0", default-features = false, features = ["experimental-reference-types-extern-ref"] }
wasmer-wasi = { path = "../../../lib/wasi", version = "2.0.0" }
wasmer-vfs = { path = "../../../lib/vfs", version = "2.0.0" }
wast = "37.0"
wast = "38.0"
serde = "1"
tempfile = "3"
thiserror = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/wast/src/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl Wast {
QuoteModule { .. } => {
// Do nothing
}
AssertUncaughtException { .. } => {
AssertException { .. } => {
// Do nothing for now
}
AssertMalformed {
Expand Down

0 comments on commit 370aba0

Please sign in to comment.