Skip to content

Commit 9005002

Browse files
committed
Auto merge of #7489 - da-x:fix-7488, r=ehuss
when -Z unstable-options not specified, don't validate --profile This fixes a regression caused by 8b0561d - Closes #7488.
2 parents a7c939c + 9dc70a3 commit 9005002

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/cargo/util/command_prelude.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,22 @@ pub trait ArgMatchesExt {
320320
}
321321

322322
if self._is_present("release") {
323-
match specified_profile {
324-
None | Some(ProfileKind::Release) => Ok(ProfileKind::Release),
325-
_ => failure::bail!("Conflicting usage of --profile and --release"),
323+
if !config.cli_unstable().unstable_options {
324+
Ok(ProfileKind::Release)
325+
} else {
326+
match specified_profile {
327+
None | Some(ProfileKind::Release) => Ok(ProfileKind::Release),
328+
_ => failure::bail!("Conflicting usage of --profile and --release"),
329+
}
326330
}
327331
} else if self._is_present("debug") {
328-
match specified_profile {
329-
None | Some(ProfileKind::Dev) => Ok(ProfileKind::Dev),
330-
_ => failure::bail!("Conflicting usage of --profile and --debug"),
332+
if !config.cli_unstable().unstable_options {
333+
Ok(ProfileKind::Dev)
334+
} else {
335+
match specified_profile {
336+
None | Some(ProfileKind::Dev) => Ok(ProfileKind::Dev),
337+
_ => failure::bail!("Conflicting usage of --profile and --debug"),
338+
}
331339
}
332340
} else {
333341
Ok(specified_profile.unwrap_or(default))

tests/testsuite/check.rs

+6
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ fn rustc_check() {
335335
.build();
336336

337337
foo.cargo("rustc --profile check -- --emit=metadata").run();
338+
339+
// Verify compatible usage of --profile with --release, issue #7488
340+
foo.cargo("rustc --profile check --release -- --emit=metadata")
341+
.run();
342+
foo.cargo("rustc --profile test --release -- --emit=metadata")
343+
.run();
338344
}
339345

340346
#[cargo_test]

0 commit comments

Comments
 (0)