Skip to content

build: fix Cargo 1.100's unused dependency warnings - #500

Merged
benbrandt merged 2 commits into
mainfrom
ci-cargo-unused-dependency-lints
Nov 14, 2026
Merged

benbrandt merged 2 commits into
mainfrom
ci-cargo-unused-dependency-lints

Conversation

@benbrandt

@benbrandt benbrandt commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

CI on main fails with the current stable toolchain. Cargo 1.100 adds two manifest lints that warn by default, and CI denies warnings (CARGO_BUILD_WARNINGS=deny, set by setup-rust-toolchain). The last green run on main used 1.99.1. #499 is the first run on 1.100, and its Build job and all eight feature powerset jobs fail for this reason.

No warning is relaxed or allowed here. Each one is fixed where it comes from.

Fixes

  • cargo::unused_workspace_dependencies in the feature powerset jobs. cargo hack --no-dev-deps removes dev-dependencies from the manifests while it runs. Nine [workspace.dependencies] entries are only inherited by dev-dependencies, so Cargo reported them as unused in every combination. The flag is gone. It is not needed with resolver 3: a library-only check of agent-client-protocol with --no-default-features resolves no features, even though its dev-dependency agent-client-protocol-test depends back on it with process and stdio.
  • cargo::unused_dependencies in agent-client-protocol-rmcp. With the flag gone, the powerset reports that the crate declares dependencies it does not use without rmcp_3, where the crate is empty. Its eight dependencies are now optional and rmcp_3 enables them. No new feature names appear, because the feature refers to them with dep:.
  • cargo::unused_dependencies in the cookbook. Only rustdoc links and doctests use agent-client-protocol-rmcp there, and rustdoc resolves links against regular dependencies only, so it cannot move to [dev-dependencies]. The cookbook now names the crate with use agent_client_protocol_rmcp as _;.

Behavior change

agent-client-protocol-rmcp with only unstable_mcp_over_acp, and no rmcp_3, no longer enables the core crate's feature. The passthrough is now agent-client-protocol?/unstable_mcp_over_acp, and the core crate is not a dependency in that configuration. Nothing in the workspace uses that combination. The README and md/features.md say so.

Verification

Run locally on Rust 1.100 with CARGO_BUILD_WARNINGS=deny, as in CI:

  • The powerset command with --each-feature instead of --feature-powerset --depth 2 (33 combinations), and the full powerset of agent-client-protocol-rmcp. I did not run the full depth-2 powerset locally.
  • cargo check --workspace --all-targets --all-features --locked and the wasm checks from the MSRV job
  • cargo fmt -- --check, cargo clippy, cargo clippy --all-targets --all-features, and the wasm clippy commands
  • the docs.rs build on nightly and the WASI docs build
  • just test

An earlier run of just test on this branch failed once in acp_agent::tests::protocol_eof_still_reports_nonzero_child_exit. That test is flaky on main (3 failures in 60 local runs of the acp_agent tests) and unrelated to this change.

Cargo 1.100 adds two manifest lints that warn by default. CI denies
warnings, so the Build job and every feature powerset job fail on `main`.

- `cargo::unused_dependencies` flags `agent-client-protocol-rmcp` in the
  cookbook. Only rustdoc links and doctests use it, and rustdoc resolves
  links against regular dependencies only, so it has to stay one. Name the
  crate with `use agent_client_protocol_rmcp as _;`.
- `cargo::unused_workspace_dependencies` flags nine workspace dependencies
  in the powerset jobs. `cargo hack --no-dev-deps` removes
  dev-dependencies from the manifests while it runs, and only
  dev-dependencies inherit those entries. Deny compiler warnings only in
  that step (`CARGO_BUILD_WARNINGS=warn`, `RUSTFLAGS=-D warnings`). The
  Build job still denies Cargo's warnings for the real manifests.
…onal

Replace the relaxed warning settings on the feature powerset step.

`cargo hack --no-dev-deps` removes dev-dependencies from the manifests
while it runs, which is what made Cargo report nine workspace dependencies
as unused. The flag is not needed with resolver 3: dev-dependencies do not
add features to the library and binary targets the job checks. Remove it
and keep denying every warning.

With every warning denied, the job reports that
`agent-client-protocol-rmcp` declares dependencies it does not use without
`rmcp_3`, where the crate is empty. Make them optional and enable them
from `rmcp_3`. The `unstable_mcp_over_acp` passthrough becomes
`agent-client-protocol?/unstable_mcp_over_acp`, so on its own it no longer
enables the core crate's feature.
@benbrandt benbrandt changed the title ci: fix the build with Cargo 1.100's unused dependency lints build: fix Cargo 1.100's unused dependency warnings Nov 14, 2026
@benbrandt
benbrandt merged commit 94ae0a4 into main Nov 14, 2026
14 checks passed
@benbrandt
benbrandt deleted the ci-cargo-unused-dependency-lints branch November 14, 2026 15:25
This was referenced Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant