Skip to content

Commit ffa9dbd

Browse files
committed
Don't change the macOS default just yet
1 parent cc5e9df commit ffa9dbd

File tree

5 files changed

+18
-61
lines changed

5 files changed

+18
-61
lines changed

src/cargo/core/compiler/standard_lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,16 @@ pub fn generate_std_roots(
162162
// in time is minimal, and the difference in caching is
163163
// significant.
164164
let mode = CompileMode::Build;
165+
let profile = profiles.get_profile(
166+
pkg.package_id(),
167+
/*is_member*/ false,
168+
/*is_local*/ false,
169+
unit_for,
170+
mode,
171+
);
165172
let features = std_features.activated_features(pkg.package_id(), FeaturesFor::NormalOrDev);
166173

167174
for kind in kinds {
168-
let profile = profiles.get_profile(
169-
pkg.package_id(),
170-
/*is_member*/ false,
171-
/*is_local*/ false,
172-
unit_for,
173-
mode,
174-
*kind,
175-
);
176175
let list = ret.entry(*kind).or_insert_with(Vec::new);
177176
list.push(interner.intern(
178177
pkg,

src/cargo/core/compiler/unit_dependencies.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ fn new_unit_dep(
593593
is_local,
594594
unit_for,
595595
mode,
596-
kind,
597596
);
598597
new_unit_dep_with_profile(state, parent, pkg, target, unit_for, kind, mode, profile)
599598
}

src/cargo/core/profiles.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::core::compiler::{CompileKind, CompileMode, Unit};
1+
use crate::core::compiler::{CompileMode, Unit};
22
use crate::core::resolver::features::FeaturesFor;
33
use crate::core::{Feature, PackageId, PackageIdSpec, Resolve, Shell, Target, Workspace};
44
use crate::util::errors::CargoResultExt;
@@ -291,7 +291,6 @@ impl Profiles {
291291
is_local: bool,
292292
unit_for: UnitFor,
293293
mode: CompileMode,
294-
kind: CompileKind,
295294
) -> Profile {
296295
let (profile_name, inherits) = if !self.named_profiles_enabled {
297296
// With the feature disabled, we degrade `--profile` back to the
@@ -347,23 +346,6 @@ impl Profiles {
347346
}
348347
}
349348

350-
// Default macOS debug information to being stored in the "packed"
351-
// split-debuginfo format. At the time of this writing that's the only
352-
// platform which has a stable `-Csplit-debuginfo` option for rustc,
353-
// and it's typically much faster than running `dsymutil` on all builds
354-
// in incremental cases.
355-
if let Some(debug) = profile.debuginfo {
356-
if profile.split_debuginfo.is_none() && debug > 0 {
357-
let target = match &kind {
358-
CompileKind::Host => self.rustc_host.as_str(),
359-
CompileKind::Target(target) => target.short_name(),
360-
};
361-
if target.contains("-apple-") {
362-
profile.split_debuginfo = Some(InternedString::new("unpacked"));
363-
}
364-
}
365-
}
366-
367349
// Incremental can be globally overridden.
368350
if let Some(v) = self.incremental {
369351
profile.incremental = v;

src/cargo/ops/cargo_compile.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -882,20 +882,19 @@ fn generate_targets(
882882
};
883883

884884
let is_local = pkg.package_id().source_id().is_path();
885+
let profile = profiles.get_profile(
886+
pkg.package_id(),
887+
ws.is_member(pkg),
888+
is_local,
889+
unit_for,
890+
target_mode,
891+
);
885892

886893
// No need to worry about build-dependencies, roots are never build dependencies.
887894
let features_for = FeaturesFor::from_for_host(target.proc_macro());
888895
let features = resolved_features.activated_features(pkg.package_id(), features_for);
889896

890897
for kind in requested_kinds {
891-
let profile = profiles.get_profile(
892-
pkg.package_id(),
893-
ws.is_member(pkg),
894-
is_local,
895-
unit_for,
896-
target_mode,
897-
kind.for_target(target),
898-
);
899898
let unit = interner.intern(
900899
pkg,
901900
target,

tests/testsuite/profile_config.rs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ fn named_config_profile() {
342342
// foo -> middle -> bar -> dev
343343
// middle exists in Cargo.toml, the others in .cargo/config
344344
use super::config::ConfigBuilder;
345-
use cargo::core::compiler::CompileKind;
346345
use cargo::core::compiler::CompileMode;
347346
use cargo::core::enable_nightly_features;
348347
use cargo::core::profiles::{Profiles, UnitFor};
@@ -406,14 +405,7 @@ fn named_config_profile() {
406405

407406
// normal package
408407
let mode = CompileMode::Build;
409-
let p = profiles.get_profile(
410-
a_pkg,
411-
true,
412-
true,
413-
UnitFor::new_normal(),
414-
mode,
415-
CompileKind::Host,
416-
);
408+
let p = profiles.get_profile(a_pkg, true, true, UnitFor::new_normal(), mode);
417409
assert_eq!(p.name, "foo");
418410
assert_eq!(p.codegen_units, Some(2)); // "foo" from config
419411
assert_eq!(p.opt_level, "1"); // "middle" from manifest
@@ -422,14 +414,7 @@ fn named_config_profile() {
422414
assert_eq!(p.overflow_checks, true); // "dev" built-in (ignore package override)
423415

424416
// build-override
425-
let bo = profiles.get_profile(
426-
a_pkg,
427-
true,
428-
true,
429-
UnitFor::new_host(false),
430-
mode,
431-
CompileKind::Host,
432-
);
417+
let bo = profiles.get_profile(a_pkg, true, true, UnitFor::new_host(false), mode);
433418
assert_eq!(bo.name, "foo");
434419
assert_eq!(bo.codegen_units, Some(6)); // "foo" build override from config
435420
assert_eq!(bo.opt_level, "0"); // default to zero
@@ -438,14 +423,7 @@ fn named_config_profile() {
438423
assert_eq!(bo.overflow_checks, true); // SAME as normal
439424

440425
// package overrides
441-
let po = profiles.get_profile(
442-
dep_pkg,
443-
false,
444-
true,
445-
UnitFor::new_normal(),
446-
mode,
447-
CompileKind::Host,
448-
);
426+
let po = profiles.get_profile(dep_pkg, false, true, UnitFor::new_normal(), mode);
449427
assert_eq!(po.name, "foo");
450428
assert_eq!(po.codegen_units, Some(7)); // "foo" package override from config
451429
assert_eq!(po.opt_level, "1"); // SAME as normal

0 commit comments

Comments
 (0)