Repository navigation
Commit 10725e3
Address review finding: declare tokio's net feature
Review finding:
This line adds tokio's `sync` feature for the new Tower server's `oneshot::channel`, but the same new binary also calls `tokio::net::TcpListener::bind` in `scenarios/http/rust/tower/opentelemetry-instrumentation-tower/server/src/main.rs`, and `net` is not in the declared feature list. `tokio::net` is gated behind tokio's `net` feature, so the crate compiles only because axum 0.8.9's `tokio` feature (enabled two lines above) transitively turns on `tokio/net`. That makes a direct API use depend on another dependency's feature choice. A fix is to add `net` to the tokio feature list so the feature the code uses directly is declared where it is used.
Analysis: Tokio exports `TcpListener` inside `cfg_net!`, so `tokio::net` exists only when the `net` feature is on. The workspace declaration listed `macros`, `rt-multi-thread` and `sync`, and axum 0.8.9's `tokio` feature turns on `tokio/net` for the whole build, which is what let the Tower server compile. Listing `net` beside `sync` states the feature the scenario binary uses directly. Cargo resolves the same versions, so `Cargo.lock` is unchanged.
Upsides: The Tower server no longer depends on axum's feature list to reach `tokio::net`, so dropping or narrowing the axum dependency fails at the manifest rather than deep in a compile error. The declaration now matches the same rule the `sync` entry follows.
Downsides: No material downside identified.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 3abcb45 commit 10725e3
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
0 commit comments