Skip to content

Commit

Permalink
Don't change the macOS default just yet
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Feb 3, 2021
1 parent cc5e9df commit ffa9dbd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 61 deletions.
15 changes: 7 additions & 8 deletions src/cargo/core/compiler/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/cargo/core/compiler/unit_dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
20 changes: 1 addition & 19 deletions src/cargo/core/profiles.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 7 additions & 8 deletions src/cargo/ops/cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 3 additions & 25 deletions tests/testsuite/profile_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ffa9dbd

Please sign in to comment.