Skip to content

Commit 3a9fd21

Browse files
committed
Auto merge of #9901 - ehuss:beta-rustc-profile-dev, r=Eh2406
[beta] Fix rustc --profile=dev unstable check. Beta backport of #9898.
2 parents d199d81 + f4baeb5 commit 3a9fd21

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/cargo/util/command_prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ pub trait ArgMatchesExt {
363363
// This is an early exit, since it allows combination with `--release`.
364364
match (specified_profile, profile_checking) {
365365
// `cargo rustc` has legacy handling of these names
366-
(Some(name @ ("test" | "bench" | "check")), ProfileChecking::LegacyRustc) |
366+
(Some(name @ ("dev" | "test" | "bench" | "check")), ProfileChecking::LegacyRustc) |
367367
// `cargo fix` and `cargo check` has legacy handling of this profile name
368368
(Some(name @ "test"), ProfileChecking::LegacyTestOnly) => return Ok(InternedString::new(name)),
369369
_ => {}

tests/testsuite/profile_custom.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,3 +702,32 @@ fn legacy_commands_support_custom() {
702702
p.build_dir().rm_rf();
703703
}
704704
}
705+
706+
#[cargo_test]
707+
fn legacy_rustc() {
708+
// `cargo rustc` historically has supported dev/test/bench/check
709+
// other profiles are covered in check::rustc_check
710+
let p = project()
711+
.file(
712+
"Cargo.toml",
713+
r#"
714+
[package]
715+
name = "foo"
716+
version = "0.1.0"
717+
718+
[profile.dev]
719+
codegen-units = 3
720+
"#,
721+
)
722+
.file("src/lib.rs", "")
723+
.build();
724+
p.cargo("rustc --profile dev -v")
725+
.with_stderr(
726+
"\
727+
[COMPILING] foo v0.1.0 [..]
728+
[RUNNING] `rustc --crate-name foo [..]-C codegen-units=3[..]
729+
[FINISHED] [..]
730+
",
731+
)
732+
.run();
733+
}

0 commit comments

Comments
 (0)