From 2f9d96cd004c3b51033a4cf16c9b24563bcfe6cf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 21 Jun 2022 15:05:14 -0500 Subject: [PATCH] Use Cargo's "namespace features" feature (#4293) Cargo recently added the ability to have an optional dependency without implicitly introducing a new named feature on a crate. This is triggered with some new directives in the `[features]` section, specifically: * The `dep:foo` syntax means that `foo` is activated but no implicit feature should be added named `foo`. * Additionally `foo?/bar` means that the `bar` feature of `foo` is only activated if `foo` is otherwise activated elsewhere, for example a conditional activation. These two features can help avoid extra feature names showing up that we don't want (e.g. currently the `wasmtime` crate has a `rayon` feature) and additionally can help avoid runtime dependencies in niche cases for us (e.g. activating `all-arch` but disabling `cranelift` would previously pull-in cranelift but no longer will). --- Cargo.toml | 4 ++-- crates/wasmtime/Cargo.toml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8315036a9a..ec4cb2d9c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,8 +101,8 @@ default = [ ] jitdump = ["wasmtime/jitdump"] vtune = ["wasmtime/vtune"] -wasi-crypto = ["wasmtime-wasi-crypto"] -wasi-nn = ["wasmtime-wasi-nn"] +wasi-crypto = ["dep:wasmtime-wasi-crypto"] +wasi-nn = ["dep:wasmtime-wasi-nn"] memory-init-cow = ["wasmtime/memory-init-cow", "wasmtime-cli-flags/memory-init-cow"] pooling-allocator = ["wasmtime/pooling-allocator", "wasmtime-cli-flags/pooling-allocator"] all-arch = ["wasmtime/all-arch"] diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml index 9026591a0a..c2481c1606 100644 --- a/crates/wasmtime/Cargo.toml +++ b/crates/wasmtime/Cargo.toml @@ -67,7 +67,7 @@ default = [ # with the Cranelift compiler. Cranelift is the default compilation backend of # Wasmtime. If disabled then WebAssembly modules can only be created from # precompiled WebAssembly modules. -cranelift = ["wasmtime-cranelift"] +cranelift = ["dep:wasmtime-cranelift"] # Enables support for the `perf` jitdump profiler jitdump = ["wasmtime-jit/jitdump"] @@ -76,14 +76,14 @@ jitdump = ["wasmtime-jit/jitdump"] vtune = ["wasmtime-jit/vtune"] # Enables parallel compilation of WebAssembly code. -parallel-compilation = ["rayon"] +parallel-compilation = ["dep:rayon"] # Enables support for automatic cache configuration to be enabled in `Config`. -cache = ["wasmtime-cache"] +cache = ["dep:wasmtime-cache"] # Enables support for "async stores" as well as defining host functions as # `async fn` and calling functions asynchronously. -async = ["wasmtime-fiber", "wasmtime-runtime/async", "async-trait"] +async = ["dep:wasmtime-fiber", "wasmtime-runtime/async", "dep:async-trait"] # Enables support for the pooling instance allocation strategy pooling-allocator = ["wasmtime-runtime/pooling-allocator"] @@ -91,7 +91,7 @@ pooling-allocator = ["wasmtime-runtime/pooling-allocator"] # Enables support for all architectures in Cranelift, allowing # cross-compilation using the `wasmtime` crate's API, notably the # `Engine::precompile_module` function. -all-arch = ["wasmtime-cranelift/all-arch"] +all-arch = ["wasmtime-cranelift?/all-arch"] # Enables trap handling using POSIX signals instead of Mach exceptions on MacOS. # It is useful for applications that do not bind their own exception ports and