From f4baeb54ddf222530f98db58f205e8f681198d3b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 10 Sep 2021 09:40:37 -0700 Subject: [PATCH] Fix rustc --profile=dev unstable check. --- src/cargo/util/command_prelude.rs | 2 +- tests/testsuite/profile_custom.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index c99b8688f1e..bab36a9a94d 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -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)), _ => {} diff --git a/tests/testsuite/profile_custom.rs b/tests/testsuite/profile_custom.rs index ff4064653f8..1307b4e071b 100644 --- a/tests/testsuite/profile_custom.rs +++ b/tests/testsuite/profile_custom.rs @@ -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(); +}