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
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();
}