Skip to content

Commit

Permalink
Auto merge of #4085 - alexcrichton:fix-rewrite, r=matklad
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed May 22, 2017
2 parents 26d1d9d + d1e70e4 commit 9fcdbb4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cargo/util/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions tests/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -663,6 +664,7 @@ fn ignore_workspace_specifier() {
[project]
name = "foo"
version = "0.0.1"
authors = []
[workspace]
Expand Down Expand Up @@ -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));
}

0 comments on commit 9fcdbb4

Please sign in to comment.