Skip to content

Commit e1d61b8

Browse files
committed
fix(package): Register workspace member renames in overlay
This was reported at #10948 (comment) I suspect there is a second bug here because my debugging only showed us doing this for `val-json` and not `concepts` and only when building `utils`. For the exact mapping between the publish payload and the index, see https://doc.rust-lang.org/cargo/reference/registry-index.html#json-schema, particularly the note about differences.
1 parent ca9bf21 commit e1d61b8

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/cargo/ops/cargo_package/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,15 @@ impl<'a> TmpRegistry<'a> {
10331033
.deps
10341034
.into_iter()
10351035
.map(|dep| {
1036-
let name = dep.name.into();
1037-
let package = None;
1036+
let name = dep
1037+
.explicit_name_in_toml
1038+
.clone()
1039+
.unwrap_or_else(|| dep.name.clone())
1040+
.into();
1041+
let package = dep
1042+
.explicit_name_in_toml
1043+
.as_ref()
1044+
.map(|_| dep.name.clone().into());
10381045
RegistryDependency {
10391046
name: name,
10401047
req: dep.version_req.into(),

tests/testsuite/package.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6566,7 +6566,6 @@ fn workspace_with_renamed_member() {
65666566
p.cargo("package -Zpackage-workspace")
65676567
.masquerade_as_nightly_cargo(&["package-workspace"])
65686568
.replace_crates_io(reg.index_url())
6569-
.with_status(101)
65706569
.with_stderr_data(
65716570
str![[r#"
65726571
[UPDATING] crates.io index
@@ -6588,15 +6587,8 @@ fn workspace_with_renamed_member() {
65886587
[UNPACKING] obeli-sk-concepts v0.16.2 (registry `[ROOT]/foo/target/package/tmp-registry`)
65896588
[COMPILING] obeli-sk-val-json v0.16.2
65906589
[COMPILING] obeli-sk-concepts v0.16.2
6591-
error[E0433]: failed to resolve: use of undeclared crate or module `val_json`
6592-
--> [ROOT]/home/.cargo/registry/src/-[HASH]/obeli-sk-concepts-0.16.2/src/lib.rs:1:16
6593-
|
6594-
1 | pub fn foo() { val_json::foo() }
6595-
| ^^^^^^^^ use of undeclared crate or module `val_json`
6596-
6597-
For more information about this error, try `rustc --explain E0433`.
6598-
[ERROR] could not compile `obeli-sk-concepts` (lib) due to 1 previous error
6599-
[ERROR] failed to verify package tarball
6590+
[COMPILING] obeli-sk-utils v0.16.2 ([ROOT]/foo/target/package/obeli-sk-utils-0.16.2)
6591+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
66006592
66016593
"#]]
66026594
.unordered(),

0 commit comments

Comments
 (0)