Skip to content

Commit d1e70e4

Browse files
committed
Fix a serialization error on publish
In TOML we have to emit all keys before we emit all sub-tables, so to handle that for dependencies just transform everything to an elaborated version. Closes #4081
1 parent 483e0ab commit d1e70e4

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/cargo/util/toml.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,10 @@ impl TomlManifest {
656656
TomlDependency::Detailed(d)
657657
}
658658
TomlDependency::Simple(ref s) => {
659-
TomlDependency::Simple(s.clone())
659+
TomlDependency::Detailed(DetailedTomlDependency {
660+
version: Some(s.clone()),
661+
..Default::default()
662+
})
660663
}
661664
}
662665
}

tests/package.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::path::{Path, PathBuf};
1212

1313
use cargotest::{cargo_process, process};
1414
use cargotest::support::{project, execs, paths, git, path2url, cargo_exe};
15+
use cargotest::support::registry::Package;
1516
use flate2::read::GzDecoder;
1617
use hamcrest::{assert_that, existing_file, contains, equal_to};
1718
use tar::Archive;
@@ -663,6 +664,7 @@ fn ignore_workspace_specifier() {
663664
[project]
664665
name = "foo"
665666
version = "0.0.1"
667+
666668
authors = []
667669
668670
[workspace]
@@ -714,3 +716,24 @@ version = "0.1.0"
714716
authors = []
715717
"#));
716718
}
719+
720+
#[test]
721+
fn package_two_kinds_of_deps() {
722+
Package::new("other", "1.0.0").publish();
723+
Package::new("other1", "1.0.0").publish();
724+
let p = project("foo")
725+
.file("Cargo.toml", r#"
726+
[project]
727+
name = "foo"
728+
version = "0.0.1"
729+
authors = []
730+
731+
[dependencies]
732+
other = "1.0"
733+
other1 = { version = "1.0" }
734+
"#)
735+
.file("src/main.rs", "");
736+
737+
assert_that(p.cargo_process("package").arg("--no-verify"),
738+
execs().with_status(0));
739+
}

0 commit comments

Comments
 (0)