Skip to content

Commit ebe84e1

Browse files
committed
Count registry = "crates-io" as re-pinnable in the Cargo remedy
Second review round. The unpinned-declaration remedy sent every declaration with an explicit `registry` key to "it names another registry ... roll the patch back", including `registry = "crates-io"`, which the hosted rewriter re-pins (#386); it now says a re-scan pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 64fce24 commit ebe84e1

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

  • crates/socket-patch-core/src/vex/discover

‎crates/socket-patch-core/src/vex/discover/cargo.rs‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,10 @@ fn beside_the_pin(
947947
let refused: Vec<String> = unpinned
948948
.iter()
949949
.filter_map(|(d, selects)| {
950-
let why = match (&d.source, d.registry.as_deref(), selects) {
950+
// `registry = "crates-io"` is crates.io itself, which the
951+
// rewriter re-pins like a declaration with no `registry` (#386).
952+
let registry = d.registry.as_deref().filter(|r| r.trim() != "crates-io");
953+
let why = match (&d.source, registry, selects) {
951954
(DeclSource::Registry, None, CargoReqMatch::Ours) => return None,
952955
(DeclSource::Registry, None, _) => {
953956
let also: Vec<&str> = others
@@ -2167,6 +2170,19 @@ mod tests {
21672170
"{}",
21682171
u.detail
21692172
);
2173+
// Review on #2019 (round 2): `registry = "crates-io"` is crates.io,
2174+
// which a re-scan re-pins (#386).
2175+
let p = mixed_workspace(
2176+
&pinned("serde", "=1.0.1", UUID_A),
2177+
"serde = { version = \"1\", registry = \"crates-io\" }",
2178+
&[],
2179+
);
2180+
let u = run(&p).await.unattested.remove(0);
2181+
assert!(
2182+
u.detail.contains("re-run `socket-patch scan`"),
2183+
"{}",
2184+
u.detail
2185+
);
21702186

21712187
// `"1"` also matches the crates.io 1.0.200 locked beside it.
21722188
let p = mixed_workspace(

0 commit comments

Comments
 (0)