|
1 | 1 | use crate::command_prelude::*; |
2 | | - |
3 | 2 | use cargo::ops; |
| 3 | +use cargo::util::interning::InternedString; |
4 | 4 |
|
5 | 5 | const PRINT_ARG_NAME: &str = "print"; |
6 | 6 |
|
@@ -46,26 +46,24 @@ pub fn cli() -> App { |
46 | 46 |
|
47 | 47 | pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { |
48 | 48 | let ws = args.workspace(config)?; |
| 49 | + // This is a legacy behavior that changes the behavior based on the profile. |
| 50 | + // If we want to support this more formally, I think adding a --mode flag |
| 51 | + // would be warranted. |
49 | 52 | let mode = match args.value_of("profile") { |
50 | | - Some("dev") | None => CompileMode::Build, |
51 | 53 | Some("test") => CompileMode::Test, |
52 | 54 | Some("bench") => CompileMode::Bench, |
53 | 55 | Some("check") => CompileMode::Check { test: false }, |
54 | | - Some(mode) => { |
55 | | - let err = anyhow::format_err!( |
56 | | - "unknown profile: `{}`, use dev, |
57 | | - test, or bench", |
58 | | - mode |
59 | | - ); |
60 | | - return Err(CliError::new(err, 101)); |
61 | | - } |
| 56 | + _ => CompileMode::Build, |
62 | 57 | }; |
63 | 58 | let mut compile_opts = args.compile_options_for_single_package( |
64 | 59 | config, |
65 | 60 | mode, |
66 | 61 | Some(&ws), |
67 | | - ProfileChecking::Unchecked, |
| 62 | + ProfileChecking::LegacyRustc, |
68 | 63 | )?; |
| 64 | + if compile_opts.build_config.requested_profile == "check" { |
| 65 | + compile_opts.build_config.requested_profile = InternedString::new("dev"); |
| 66 | + } |
69 | 67 | let target_args = values(args, "args"); |
70 | 68 | compile_opts.target_rustc_args = if target_args.is_empty() { |
71 | 69 | None |
|
0 commit comments