Skip to content

Commit 01a0c24

Browse files
committed
profiles: add feature gating on 'inherits' and validate names
1 parent 1e097c3 commit 01a0c24

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/cargo/core/profiles.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,25 @@ impl Profiles {
5454
BTreeMap::new()
5555
};
5656

57-
// Feature gating
57+
// Feature gating and name validation
5858
for (profile_name, profile) in &profiles {
5959
match profile_name.as_str() {
6060
"dev" | "release" | "bench" | "test" | "doc" | "check" => {
61-
if profile.dir_name.is_some() {
62-
features.require(Feature::named_profiles())?;
63-
break;
64-
}
65-
6661
match &profile.dir_name {
6762
None => {}
6863
Some(dir_name) => {
64+
features.require(Feature::named_profiles())?;
6965
validate_name(&dir_name, "dir-name")?;
7066
}
7167
}
68+
69+
match &profile.inherits {
70+
None => {}
71+
Some(inherits) => {
72+
features.require(Feature::named_profiles())?;
73+
validate_name(&inherits, "inherits")?;
74+
}
75+
}
7276
}
7377
_ => {
7478
features.require(Feature::named_profiles())?;

0 commit comments

Comments
 (0)