Skip to content

Commit

Permalink
Auto merge of #3776 - alexcrichton:underscores, r=matklad
Browse files Browse the repository at this point in the history
Accept more underscore variants in configuration

Preserving more historical behavior of the old TOML parser.
  • Loading branch information
bors committed Feb 28, 2017
2 parents 09b68aa + 47d1800 commit e2e6834
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/cargo/util/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,12 @@ pub struct TomlManifest {
dependencies: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "dev-dependencies")]
dev_dependencies: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "dev_dependencies")]
dev_dependencies2: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "build-dependencies")]
build_dependencies: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "build_dependencies")]
build_dependencies2: Option<HashMap<String, TomlDependency>>,
features: Option<HashMap<String, Vec<String>>>,
target: Option<HashMap<String, TomlPlatform>>,
replace: Option<HashMap<String, TomlDependency>>,
Expand Down Expand Up @@ -630,19 +634,23 @@ impl TomlManifest {
// Collect the deps
process_dependencies(&mut cx, self.dependencies.as_ref(),
None)?;
process_dependencies(&mut cx, self.dev_dependencies.as_ref(),
Some(Kind::Development))?;
process_dependencies(&mut cx, self.build_dependencies.as_ref(),
Some(Kind::Build))?;
let dev_deps = self.dev_dependencies.as_ref()
.or(self.dev_dependencies2.as_ref());
process_dependencies(&mut cx, dev_deps, Some(Kind::Development))?;
let build_deps = self.build_dependencies.as_ref()
.or(self.build_dependencies2.as_ref());
process_dependencies(&mut cx, build_deps, Some(Kind::Build))?;

for (name, platform) in self.target.iter().flat_map(|t| t) {
cx.platform = Some(name.parse()?);
process_dependencies(&mut cx, platform.dependencies.as_ref(),
None)?;
process_dependencies(&mut cx, platform.build_dependencies.as_ref(),
Some(Kind::Build))?;
process_dependencies(&mut cx, platform.dev_dependencies.as_ref(),
Some(Kind::Development))?;
let build_deps = platform.build_dependencies.as_ref()
.or(platform.build_dependencies2.as_ref());
process_dependencies(&mut cx, build_deps, Some(Kind::Build))?;
let dev_deps = platform.dev_dependencies.as_ref()
.or(platform.dev_dependencies2.as_ref());
process_dependencies(&mut cx, dev_deps, Some(Kind::Development))?;
}

replace = self.replace(&mut cx)?;
Expand Down Expand Up @@ -998,8 +1006,12 @@ struct TomlPlatform {
dependencies: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "build-dependencies")]
build_dependencies: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "build_dependencies")]
build_dependencies2: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "dev-dependencies")]
dev_dependencies: Option<HashMap<String, TomlDependency>>,
#[serde(rename = "dev_dependencies")]
dev_dependencies2: Option<HashMap<String, TomlDependency>>,
}

impl TomlTarget {
Expand Down

0 comments on commit e2e6834

Please sign in to comment.