Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,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