mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Disable the dir-name profile setting.
dir-name primarily exists for translating the built-in profiles. In order to simplify the UI, we would like to not expose it to the user for the initial stabilization. The code to support it is kept in case we want to add it in the future.
This commit is contained in:
parent
38c8ce6cab
commit
090eb4277f
@ -520,16 +520,16 @@ impl TomlProfile {
|
||||
features.require(Feature::named_profiles())?;
|
||||
}
|
||||
|
||||
if self.dir_name.is_some() {
|
||||
features.require(Feature::named_profiles())?;
|
||||
}
|
||||
|
||||
// `dir-name` validation
|
||||
match &self.dir_name {
|
||||
None => {}
|
||||
Some(dir_name) => {
|
||||
Self::validate_name(dir_name, "dir-name")?;
|
||||
}
|
||||
if let Some(dir_name) = self.dir_name {
|
||||
// This is disabled for now, as we would like to stabilize named
|
||||
// profiles without this, and then decide in the future if it is
|
||||
// needed. This helps simplify the UI a little.
|
||||
bail!(
|
||||
"dir-name=\"{}\" in profile `{}` is not currently allowed, \
|
||||
directory names are tied to the profile name for custom profiles",
|
||||
dir_name,
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
// `inherits` validation
|
||||
|
@ -100,6 +100,7 @@ Caused by:
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
#[ignore] // dir-name is currently disabled
|
||||
fn invalid_dir_name() {
|
||||
let p = project()
|
||||
.file(
|
||||
@ -134,6 +135,42 @@ Caused by:
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn dir_name_disabled() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
cargo-features = ["named-profiles"]
|
||||
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.1.0"
|
||||
|
||||
[profile.release-lto]
|
||||
inherits = "release"
|
||||
dir-name = "lto"
|
||||
lto = true
|
||||
"#,
|
||||
)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("build")
|
||||
.masquerade_as_nightly_cargo()
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
dir-name=\"lto\" in profile `release-lto` is not currently allowed, \
|
||||
directory names are tied to the profile name for custom profiles
|
||||
",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn invalid_inherits() {
|
||||
let p = project()
|
||||
|
Loading…
x
Reference in New Issue
Block a user