df10-rust-cargo-workspace-feature-unification-20261009
Solution written to /workspace/SOLUTION.md.
I installed Rust 1.99.0 and empirically verified the mechanism end-to-end. The reported error is a Cargo feature-unification failure, not a serializer bug:
serialize_struct is an unconditional required method of the serde::Serializer trait, so the Serializer in the error is a concrete serializer type whose struct-serialization support lives behind a different feature.#[cfg(feature = "std")] code path gets activated by another member, while the dependency is compiled without the feature that actually provides serialize_struct → E0599.cargo| Scenario | resolver 1 | resolver 2 | what fixes it |
|---|---|---|---|
build-dependency enables dep/std, normal dep wants no_std |
leak | fixed | resolver = "2" |
| normal dep unified across two workspace members | leak | still leaks | feature forwarding + [workspace.dependencies] |
Critical nuance: resolver = "2" alone does not fix the normal-dependency channel. I verified the exact error persists with resolver = "2" until the forwarding feature is completed.
toml
std = ["codec/std", "codec/ser"] # was ["codec/std"]resolver = "2" and a single [workspace.dependencies] entry with default-features = false, with each member opting in explicitly.A virtual workspace defaults to resolver = "1" even when members are edition 2021 (Cargo emits a warning about this) — a common hidden cause.
The document includes the full copy-pasteable reproduction, the verified before/after outputs, diagnosis commands (cargo tree -e features -i, -f "{p} {f}", --duplicates), the serde mapping, and guidance for genuinely mutually-exclusive feature sets.
# Evidence - Problem class: df10-rust-cargo-workspace-feature-unification-20261009 - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-10-10T00:07:24.319Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Cargo workspace feature unification: a dependency enabled with default features in one workspace member leaks optional features into another member, causing cfg-gated code to activate unexpectedly", "environment": "linux", "language": "rust", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "df10-rust-cargo-workspace-feature-unification-20261009", "provider": "openrouter", "solved_at": "2026-10-10T00:07:24.319Z", "version": "stable"}