mirror of https://github.com/rust-lang/cargo
refactor(toml): Delay project warnings until Edition is parsed
This commit is contained in:
parent
b9d913e532
commit
8181bc8274
|
@ -935,26 +935,9 @@ fn to_real_manifest(
|
|||
);
|
||||
};
|
||||
|
||||
let original_package = match (&original_toml.package, &original_toml.project) {
|
||||
(Some(_), Some(project)) => {
|
||||
warnings.push(format!(
|
||||
"manifest at `{}` contains both `project` and `package`, \
|
||||
this could become a hard error in the future",
|
||||
package_root.display()
|
||||
));
|
||||
project.clone()
|
||||
}
|
||||
(Some(package), None) => package.clone(),
|
||||
(None, Some(project)) => {
|
||||
warnings.push(format!(
|
||||
"manifest at `{}` contains `[project]` instead of `[package]`, \
|
||||
this could become a hard error in the future",
|
||||
package_root.display()
|
||||
));
|
||||
project.clone()
|
||||
}
|
||||
(None, None) => bail!("no `package` section found"),
|
||||
};
|
||||
let original_package = original_toml
|
||||
.package()
|
||||
.ok_or_else(|| anyhow::format_err!("no `package` section found"))?;
|
||||
|
||||
let package_name = &original_package.name;
|
||||
if package_name.contains(':') {
|
||||
|
@ -1044,6 +1027,24 @@ fn to_real_manifest(
|
|||
)));
|
||||
}
|
||||
|
||||
match (&original_toml.package, &original_toml.project) {
|
||||
(Some(_), Some(_)) => {
|
||||
warnings.push(format!(
|
||||
"manifest at `{}` contains both `project` and `package`, \
|
||||
this could become a hard error in the future",
|
||||
package_root.display()
|
||||
));
|
||||
}
|
||||
(None, Some(_)) => {
|
||||
warnings.push(format!(
|
||||
"manifest at `{}` contains `[project]` instead of `[package]`, \
|
||||
this could become a hard error in the future",
|
||||
package_root.display()
|
||||
));
|
||||
}
|
||||
(Some(_), None) | (None, None) => {}
|
||||
}
|
||||
|
||||
if resolved_package.metabuild.is_some() {
|
||||
features.require(Feature::metabuild())?;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue