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
This commit is contained in:
Alex Crichton 2017-05-22 08:56:27 -07:00
parent 483e0ab0e6
commit d1e70e49b3
2 changed files with 27 additions and 1 deletions

View file

@ -656,7 +656,10 @@ impl TomlManifest {
TomlDependency::Detailed(d)
}
TomlDependency::Simple(ref s) => {
TomlDependency::Simple(s.clone())
TomlDependency::Detailed(DetailedTomlDependency {
version: Some(s.clone()),
..Default::default()
})
}
}
}

View file

@ -12,6 +12,7 @@ use std::path::{Path, PathBuf};
use cargotest::{cargo_process, process};
use cargotest::support::{project, execs, paths, git, path2url, cargo_exe};
use cargotest::support::registry::Package;
use flate2::read::GzDecoder;
use hamcrest::{assert_that, existing_file, contains, equal_to};
use tar::Archive;
@ -663,6 +664,7 @@ fn ignore_workspace_specifier() {
[project]
name = "foo"
version = "0.0.1"
authors = []
[workspace]
@ -714,3 +716,24 @@ version = "0.1.0"
authors = []
"#));
}
#[test]
fn package_two_kinds_of_deps() {
Package::new("other", "1.0.0").publish();
Package::new("other1", "1.0.0").publish();
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
[dependencies]
other = "1.0"
other1 = { version = "1.0" }
"#)
.file("src/main.rs", "");
assert_that(p.cargo_process("package").arg("--no-verify"),
execs().with_status(0));
}