Skip to content

Commit

Permalink
Auto merge of #10495 - ehuss:remove-profile-panic-inherit, r=weihanglo
Browse files Browse the repository at this point in the history
Remove unused profile support for -Zpanic-abort-tests

This removes the vestigial `PanicSetting::Inherit` setting.

This was initially introduced in #7460 which added `-Zpanic-abort-tests`. This was needed at the time because `test` and `dev` profiles were separate, but they were inter-mixed when running `cargo test`. That would cause a problem if the unwind/abort settings were mixed.  However, with named profiles, `test` now inherits from `dev`, so this is no longer necessary. Now that named profiles are stable, support for the old form is no longer necessary.
  • Loading branch information
bors committed Mar 25, 2022
2 parents 1366225 + e389ff7 commit af8ddf5
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/cargo/core/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,14 @@ impl Profiles {
unit_for: UnitFor,
kind: CompileKind,
) -> Profile {
let (profile_name, inherits) = (self.requested_profile, None);
let maker = self.get_profile_maker(profile_name).unwrap();
let maker = self.get_profile_maker(self.requested_profile).unwrap();
let mut profile = maker.get_profile(Some(pkg_id), is_member, unit_for.is_for_host());

// Dealing with `panic=abort` and `panic=unwind` requires some special
// treatment. Be sure to process all the various options here.
match unit_for.panic_setting() {
PanicSetting::AlwaysUnwind => profile.panic = PanicStrategy::Unwind,
PanicSetting::ReadProfile => {}
PanicSetting::Inherit => {
if let Some(inherits) = inherits {
// TODO: Fixme, broken with named profiles.
let maker = self.get_profile_maker(inherits).unwrap();
profile.panic = maker
.get_profile(Some(pkg_id), is_member, unit_for.is_for_host())
.panic;
}
}
}

// Default macOS debug information to being stored in the "unpacked"
Expand Down Expand Up @@ -285,7 +275,7 @@ impl Profiles {
if !is_local {
profile.incremental = false;
}
profile.name = profile_name;
profile.name = self.requested_profile;
profile
}

Expand Down Expand Up @@ -840,10 +830,6 @@ enum PanicSetting {
/// Indicates that this unit will read its `profile` setting and use
/// whatever is configured there.
ReadProfile,

/// This unit will ignore its `panic` setting in its profile and will
/// instead inherit it from the `dev` or `release` profile, as appropriate.
Inherit,
}

impl UnitFor {
Expand Down Expand Up @@ -909,7 +895,7 @@ impl UnitFor {
// (basically avoid recompiles) but historical defaults required
// that we always unwound.
panic_setting: if config.cli_unstable().panic_abort_tests {
PanicSetting::Inherit
PanicSetting::ReadProfile
} else {
PanicSetting::AlwaysUnwind
},
Expand Down

0 comments on commit af8ddf5

Please sign in to comment.