diff --git a/src/cargo/core/compiler/standard_lib.rs b/src/cargo/core/compiler/standard_lib.rs index 67d6189304b..0b14df8055a 100644 --- a/src/cargo/core/compiler/standard_lib.rs +++ b/src/cargo/core/compiler/standard_lib.rs @@ -162,17 +162,16 @@ pub fn generate_std_roots( // in time is minimal, and the difference in caching is // significant. let mode = CompileMode::Build; + let profile = profiles.get_profile( + pkg.package_id(), + /*is_member*/ false, + /*is_local*/ false, + unit_for, + mode, + ); let features = std_features.activated_features(pkg.package_id(), FeaturesFor::NormalOrDev); for kind in kinds { - let profile = profiles.get_profile( - pkg.package_id(), - /*is_member*/ false, - /*is_local*/ false, - unit_for, - mode, - *kind, - ); let list = ret.entry(*kind).or_insert_with(Vec::new); list.push(interner.intern( pkg, diff --git a/src/cargo/core/compiler/unit_dependencies.rs b/src/cargo/core/compiler/unit_dependencies.rs index 22c29c66f34..9445bb8861e 100644 --- a/src/cargo/core/compiler/unit_dependencies.rs +++ b/src/cargo/core/compiler/unit_dependencies.rs @@ -593,7 +593,6 @@ fn new_unit_dep( is_local, unit_for, mode, - kind, ); new_unit_dep_with_profile(state, parent, pkg, target, unit_for, kind, mode, profile) } diff --git a/src/cargo/core/profiles.rs b/src/cargo/core/profiles.rs index b65832407ba..dcc4011e81d 100644 --- a/src/cargo/core/profiles.rs +++ b/src/cargo/core/profiles.rs @@ -1,4 +1,4 @@ -use crate::core::compiler::{CompileKind, CompileMode, Unit}; +use crate::core::compiler::{CompileMode, Unit}; use crate::core::resolver::features::FeaturesFor; use crate::core::{Feature, PackageId, PackageIdSpec, Resolve, Shell, Target, Workspace}; use crate::util::errors::CargoResultExt; @@ -291,7 +291,6 @@ impl Profiles { is_local: bool, unit_for: UnitFor, mode: CompileMode, - kind: CompileKind, ) -> Profile { let (profile_name, inherits) = if !self.named_profiles_enabled { // With the feature disabled, we degrade `--profile` back to the @@ -347,23 +346,6 @@ impl Profiles { } } - // Default macOS debug information to being stored in the "packed" - // split-debuginfo format. At the time of this writing that's the only - // platform which has a stable `-Csplit-debuginfo` option for rustc, - // and it's typically much faster than running `dsymutil` on all builds - // in incremental cases. - if let Some(debug) = profile.debuginfo { - if profile.split_debuginfo.is_none() && debug > 0 { - let target = match &kind { - CompileKind::Host => self.rustc_host.as_str(), - CompileKind::Target(target) => target.short_name(), - }; - if target.contains("-apple-") { - profile.split_debuginfo = Some(InternedString::new("unpacked")); - } - } - } - // Incremental can be globally overridden. if let Some(v) = self.incremental { profile.incremental = v; diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 2a32ad7b2f7..b14bb5d690f 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -882,20 +882,19 @@ fn generate_targets( }; let is_local = pkg.package_id().source_id().is_path(); + let profile = profiles.get_profile( + pkg.package_id(), + ws.is_member(pkg), + is_local, + unit_for, + target_mode, + ); // No need to worry about build-dependencies, roots are never build dependencies. let features_for = FeaturesFor::from_for_host(target.proc_macro()); let features = resolved_features.activated_features(pkg.package_id(), features_for); for kind in requested_kinds { - let profile = profiles.get_profile( - pkg.package_id(), - ws.is_member(pkg), - is_local, - unit_for, - target_mode, - kind.for_target(target), - ); let unit = interner.intern( pkg, target, diff --git a/tests/testsuite/profile_config.rs b/tests/testsuite/profile_config.rs index 437c85cd460..2449e5a171e 100644 --- a/tests/testsuite/profile_config.rs +++ b/tests/testsuite/profile_config.rs @@ -342,7 +342,6 @@ fn named_config_profile() { // foo -> middle -> bar -> dev // middle exists in Cargo.toml, the others in .cargo/config use super::config::ConfigBuilder; - use cargo::core::compiler::CompileKind; use cargo::core::compiler::CompileMode; use cargo::core::enable_nightly_features; use cargo::core::profiles::{Profiles, UnitFor}; @@ -406,14 +405,7 @@ fn named_config_profile() { // normal package let mode = CompileMode::Build; - let p = profiles.get_profile( - a_pkg, - true, - true, - UnitFor::new_normal(), - mode, - CompileKind::Host, - ); + let p = profiles.get_profile(a_pkg, true, true, UnitFor::new_normal(), mode); assert_eq!(p.name, "foo"); assert_eq!(p.codegen_units, Some(2)); // "foo" from config assert_eq!(p.opt_level, "1"); // "middle" from manifest @@ -422,14 +414,7 @@ fn named_config_profile() { assert_eq!(p.overflow_checks, true); // "dev" built-in (ignore package override) // build-override - let bo = profiles.get_profile( - a_pkg, - true, - true, - UnitFor::new_host(false), - mode, - CompileKind::Host, - ); + let bo = profiles.get_profile(a_pkg, true, true, UnitFor::new_host(false), mode); assert_eq!(bo.name, "foo"); assert_eq!(bo.codegen_units, Some(6)); // "foo" build override from config assert_eq!(bo.opt_level, "0"); // default to zero @@ -438,14 +423,7 @@ fn named_config_profile() { assert_eq!(bo.overflow_checks, true); // SAME as normal // package overrides - let po = profiles.get_profile( - dep_pkg, - false, - true, - UnitFor::new_normal(), - mode, - CompileKind::Host, - ); + let po = profiles.get_profile(dep_pkg, false, true, UnitFor::new_normal(), mode); assert_eq!(po.name, "foo"); assert_eq!(po.codegen_units, Some(7)); // "foo" package override from config assert_eq!(po.opt_level, "1"); // SAME as normal