Skip to content

Commit 47007d9

Browse files
committed
cargo_compile: earlier profile name validation
1 parent c2a8ca1 commit 47007d9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cargo/ops/cargo_compile.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ pub fn compile_ws<'a>(
302302

303303
let profiles = ws.profiles();
304304

305+
// Early check for whether the profile is defined.
306+
let _ = profiles.base_profile(&build_config.profile_kind)?;
307+
305308
let specs = spec.to_package_id_specs(ws)?;
306309
let dev_deps = ws.require_optional_deps() || filter.need_dev_deps(build_config.mode);
307310
let opts = ResolveOpts::new(dev_deps, features, all_features, !no_default_features);
@@ -633,8 +636,6 @@ fn generate_targets<'a>(
633636
resolve: &'a Resolve,
634637
bcx: &BuildContext<'a, '_>,
635638
) -> CargoResult<Vec<Unit<'a>>> {
636-
let _ = profiles.base_profile(&bcx.build_config.profile_kind)?;
637-
638639
// Helper for creating a `Unit` struct.
639640
let new_unit = |pkg: &'a Package, target: &'a Target, target_mode: CompileMode| {
640641
let unit_for = if bcx.build_config.mode.is_any_test() {

0 commit comments

Comments
 (0)