Explicitly declare directly used dependency features#3594
Merged
itowlson merged 1 commit intoJul 1, 2026
Conversation
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
81d3cf0 to
05b25f2
Compare
Collaborator
|
Does the test work? I tried running |
Contributor
Author
|
Hi @itowlson, that command is mostly for checking whether this PR broke dependencies. Currently, without Cargo work, there isn't a way to check whether the features used in spin code are explicitly declared in |
itowlson
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes dependency feature declarations match the APIs Spin uses directly, instead of relying on those features being enabled by other crates in the dependency graph.
It also narrows a few existing Tokio declarations so production dependencies only carry the features used by production code, with test-only runtime features moved to dev-dependencies.
It may be helpful to prevent future confusion like this.
Fully resolve this kind of issue requires work on the Cargo side: rust-lang/cargo#14375
Direct feature usage
reqwest/jsonfor root integration tests:resp.json()and.json(&body).clap/deriveforspin-trigger-http:#[derive(Args)].clap/envforspin-trigger-http:#[clap(..., env = ...)].hyper-util/client-legacyforspin-factor-outbound-http:hyper_util::client::legacy::{Client, connect::*}.hyper-util/http1forspin-factor-outbound-http: the HTTP/1 client build path.hyper-util/http2forspin-factor-outbound-http:http2_only(true).tokio/fsforspin-dependency-wit:tokio::fs::remove_file,create_dir_all,write, andread.tokio/fsforspin-environments:tokio::fs::read_to_stringandtokio::fs::read.tokio/syncforspin-environments:tokio::sync::RwLock.tokio/timeforspin-environments:tokio::time::timeout.tokio/netforspin-factor-outbound-http:tokio::net::lookup_host.tokio/rtforspin-factor-outbound-http:tokio::task_local!.tokio/timeforspin-factor-outbound-http:tokio::time::Sleepandtokio::time::sleep.tokio/macrosandtokio/rt-multi-threadforspin-factor-outbound-httptests:#[tokio::test(flavor = "multi_thread")].tokio/rtforspin-factor-outbound-mysql:tokio::spawn.tokio/syncforspin-factor-outbound-mysql:tokio::sync::{Mutex, mpsc, oneshot}.tokio/macrosandtokio/rtforspin-factor-outbound-mysqltests:#[tokio::test].tokio/syncforspin-factor-sqlite:tokio::sync::{mpsc, oneshot}.tokio/macrosandtokio/rt-multi-threadforspin-factor-variablestests:#[tokio::test(flavor = "multi_thread")].tokio/rtforspin-key-value-aws:tokio::spawn.tokio/syncforspin-key-value-aws:tokio::sync::{mpsc, oneshot}.tokio/rtforspin-key-value-azure:tokio::spawn.tokio/syncforspin-key-value-azure:tokio::sync::{mpsc, oneshot}.tokio/rtforspin-key-value-redis:tokio::spawn.tokio/syncforspin-key-value-redis:tokio::sync::OnceCellandmpsc/oneshot.tokio/rtforspin-key-value-spin:tokio::task::spawn_blocking.tokio/syncforspin-key-value-spin:tokio::sync::{mpsc, oneshot}.tokio/macrosandtokio/rt-multi-threadforspin-key-value-spintests:#[tokio::test(flavor = "multi_thread", worker_threads = 1)].tokio/fsforspin-llm-local:tokio::fs::read_dir.tokio/rtforspin-llm-local:tokio::task::spawn_blocking.tokio/fsforspin-loader:tokio::fs::write.tokio/io-utilforspin-loader:tokio::io::AsyncWriteExt.tokio/syncforspin-loader:tokio::sync::Semaphore.tokio/fsforspin-oci:tokio::fs::read_to_string,tokio::fs::read, andtokio::fs::write.tokio/io-utilforspin-oci:tokio::io::AsyncWriteExt.tokio/rtforspin-oci:tokio::task::spawn_blocking.tokio/macrosandtokio/rtforspin-ocitests:#[tokio::test].tokio/macrosandtokio/rt-multi-threadforspin-runtime-configtests:#[tokio::test(flavor = "multi_thread", worker_threads = 1)].tokio/rtforspin-sqlite-inproc:tokio::task::spawn_blocking.tokio/syncforspin-sqlite-inproc:tokio::sync::{oneshot, mpsc}.tokio/macrosandtokio/rtforspin-app,spin-dependency-wit,spin-environments,spin-loader, andspin-triggertests: examples includecrates/app/src/lib.rs,crates/dependency-wit/src/lib.rs,crates/environments/src/environment.rs,crates/loader/src/cache.rs, andcrates/trigger/src/cli/sqlite_statements.rs.tokio/syncforspin-triggertests:tokio::sync::{mpsc, oneshot}.tokio/syncforspin-wasi-async:tokio::sync::mpsc::Receiver.Notes
spin-dependency-wit,spin-key-value-spin,spin-llm-local, andspin-factor-outbound-mysqlwere narrowed where the previous declaration was broader than direct source usage required.
Test commands