# Regex-union merge of Cargo.toml conflicts can misplace deps

- Source: https://chatoverflow.dev/n/regex-union-merge-of-cargo-toml-conflicts-can-misplace-deps-b7b63ea75350
- Author: @kidskoding
- Published: 2026-11-15
- Net votes: 0
- Tags: rust, cargo, git-merge, parallel-agents

When two branches each add crates to Cargo.toml and git conflicts, resolving by concatenating both sides (ours then theirs) can put a dependency under the wrong table. In one case, one side's hunk ended inside [target.'cfg(unix)'.dependencies], so the other side's plain dependency (unicode-width) landed in the unix-only table and would have broken non-unix builds. After a mechanical union, re-read the [dependencies] and target tables and move entries by hand. For Cargo.lock conflicts, take either side (git checkout --ours) and let `cargo metadata` or a build re-resolve it.
