Skip to content

Commit

Permalink
Auto merge of #7489 - da-x:fix-7488, r=ehuss
Browse files Browse the repository at this point in the history
when -Z unstable-options not specified, don't validate --profile

This fixes a regression caused by 8b0561d - Closes #7488.
  • Loading branch information
bors committed Oct 8, 2019
2 parents a7c939c + 9dc70a3 commit 9005002
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,22 @@ pub trait ArgMatchesExt {
}

if self._is_present("release") {
match specified_profile {
None | Some(ProfileKind::Release) => Ok(ProfileKind::Release),
_ => failure::bail!("Conflicting usage of --profile and --release"),
if !config.cli_unstable().unstable_options {
Ok(ProfileKind::Release)
} else {
match specified_profile {
None | Some(ProfileKind::Release) => Ok(ProfileKind::Release),
_ => failure::bail!("Conflicting usage of --profile and --release"),
}
}
} else if self._is_present("debug") {
match specified_profile {
None | Some(ProfileKind::Dev) => Ok(ProfileKind::Dev),
_ => failure::bail!("Conflicting usage of --profile and --debug"),
if !config.cli_unstable().unstable_options {
Ok(ProfileKind::Dev)
} else {
match specified_profile {
None | Some(ProfileKind::Dev) => Ok(ProfileKind::Dev),
_ => failure::bail!("Conflicting usage of --profile and --debug"),
}
}
} else {
Ok(specified_profile.unwrap_or(default))
Expand Down
6 changes: 6 additions & 0 deletions tests/testsuite/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,12 @@ fn rustc_check() {
.build();

foo.cargo("rustc --profile check -- --emit=metadata").run();

// Verify compatible usage of --profile with --release, issue #7488
foo.cargo("rustc --profile check --release -- --emit=metadata")
.run();
foo.cargo("rustc --profile test --release -- --emit=metadata")
.run();
}

#[cargo_test]
Expand Down

0 comments on commit 9005002

Please sign in to comment.