Skip to content

Commit

Permalink
Auto merge of #9901 - ehuss:beta-rustc-profile-dev, r=Eh2406
Browse files Browse the repository at this point in the history
[beta] Fix rustc --profile=dev unstable check.

Beta backport of #9898.
  • Loading branch information
bors committed Sep 10, 2021
2 parents d199d81 + f4baeb5 commit 3a9fd21
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ pub trait ArgMatchesExt {
// This is an early exit, since it allows combination with `--release`.
match (specified_profile, profile_checking) {
// `cargo rustc` has legacy handling of these names
(Some(name @ ("test" | "bench" | "check")), ProfileChecking::LegacyRustc) |
(Some(name @ ("dev" | "test" | "bench" | "check")), ProfileChecking::LegacyRustc) |
// `cargo fix` and `cargo check` has legacy handling of this profile name
(Some(name @ "test"), ProfileChecking::LegacyTestOnly) => return Ok(InternedString::new(name)),
_ => {}
Expand Down
29 changes: 29 additions & 0 deletions tests/testsuite/profile_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,3 +702,32 @@ fn legacy_commands_support_custom() {
p.build_dir().rm_rf();
}
}

#[cargo_test]
fn legacy_rustc() {
// `cargo rustc` historically has supported dev/test/bench/check
// other profiles are covered in check::rustc_check
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[profile.dev]
codegen-units = 3
"#,
)
.file("src/lib.rs", "")
.build();
p.cargo("rustc --profile dev -v")
.with_stderr(
"\
[COMPILING] foo v0.1.0 [..]
[RUNNING] `rustc --crate-name foo [..]-C codegen-units=3[..]
[FINISHED] [..]
",
)
.run();
}

0 comments on commit 3a9fd21

Please sign in to comment.