@@ -129,12 +129,19 @@ jobs:
129129 - name : Patch transitive crates.io dependencies
130130 run : |
131131 # Crates such as soroban-poseidon are pulled from crates.io and depend on
132- # soroban-sdk from crates.io. The path rewrites above cannot redirect those
133- # transitive copies, so two soroban-sdk crates get linked, producing duplicate
134- # `panic_impl` lang item errors (E0152, #1723). A [patch.crates-io] table in
135- # the workspace root redirects transitive copies to the local checkout (valid
136- # while the local version is semver-compatible with the required one).
137- # Reuse the crate list collected in the "Patch SDK versions" step.
132+ # soroban-sdk from crates.io. The path rewrites above only redirect directly
133+ # named dependency edges, so those transitive copies stay on crates.io and two
134+ # soroban-sdk crates get linked -> duplicate `panic_impl` lang item (E0152,
135+ # #1723). Collapse them in two moves, both over the crate list collected in
136+ # "Patch SDK versions":
137+ # 1. Add a [patch.crates-io] table pointing each crate at the local checkout.
138+ # A [patch] entry adds the path crate's version to crates.io resolution,
139+ # but on its own it leaves a transitive edge the lock pinned to a
140+ # different registry version untouched.
141+ # 2. cargo update each crate so that edge re-resolves onto the patched
142+ # version, leaving a single local copy in the graph. (Can't rescue an
143+ # incompatible-major transitive dep, so the matrix exclusion is still
144+ # needed.)
138145 workspace_root=$(cargo metadata --format-version 1 --no-deps | jq -r '.workspace_root')
139146 if [ -s "$RUNNER_TEMP/sdk-crates.tsv" ]; then
140147 # Don't emit a second [patch.crates-io] header if one already exists upstream.
@@ -143,6 +150,13 @@ jobs:
143150 rel_path=$(realpath --relative-to="$workspace_root" "$crate_dir")
144151 echo "$crate = { path = \"$rel_path\" }" >> "$workspace_root/Cargo.toml"
145152 done < "$RUNNER_TEMP/sdk-crates.tsv"
153+ # Re-resolve only the patched crates that are actually in the graph.
154+ graph=$(cargo metadata --format-version 1 | jq -r '.packages[].name')
155+ while IFS=$'\t' read -r crate crate_dir; do
156+ if grep -qxF "$crate" <<< "$graph"; then
157+ cargo update -p "$crate"
158+ fi
159+ done < "$RUNNER_TEMP/sdk-crates.tsv"
146160 fi
147161
148162 - name : Diff
0 commit comments