Skip to content

Commit fad192d

Browse files
committed
named-profiles: fix backward compatibility for rustc with --profile=check
And a small cleanup in `base_profile` to make the logic parallel to the one in `get_profile`.
1 parent e634ee5 commit fad192d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/cargo/core/profiles.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ impl Profiles {
322322
let release = match profile_kind {
323323
ProfileKind::Release => true,
324324
ProfileKind::Custom(ref s) if s == "bench" => true,
325-
ProfileKind::Custom(ref s) if s == "test" => false,
326325
_ => false,
327326
};
328327

@@ -397,7 +396,17 @@ impl Profiles {
397396
/// `[Finished]` line. It is not entirely accurate, since it doesn't
398397
/// select for the package that was actually built.
399398
pub fn base_profile(&self, profile_kind: &ProfileKind) -> CargoResult<Profile> {
400-
match self.by_name.get(profile_kind.name()) {
399+
let profile_name = if !self.named_profiles_enabled {
400+
match profile_kind {
401+
ProfileKind::Release => "release",
402+
ProfileKind::Custom(ref s) if s == "bench" => "bench",
403+
_ => "dev",
404+
}
405+
} else {
406+
profile_kind.name()
407+
};
408+
409+
match self.by_name.get(profile_name) {
401410
None => failure::bail!("Profile `{}` undefined", profile_kind.name()),
402411
Some(r) => Ok(r.get_profile(None, true, UnitFor::new_normal())),
403412
}

0 commit comments

Comments
 (0)