From 4b981c26487ebe56de6b3000fcd98713804beefc Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Thu, 23 Mar 2023 23:39:41 +0000 Subject: [PATCH] Rename -Zoom=panic to -Zoom=unwind --- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_session/src/config.rs | 6 +++--- compiler/rustc_session/src/options.rs | 2 +- library/alloc/src/alloc.rs | 4 ++-- tests/ui/oom_unwind.rs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 10dfd32d418..101967503c1 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -776,7 +776,7 @@ macro_rules! tracked { tracked!(no_link, true); tracked!(no_profiler_runtime, true); tracked!(no_unique_section_names, true); - tracked!(oom, OomStrategy::Panic); + tracked!(oom, OomStrategy::Unwind); tracked!(osx_rpath_install_name, true); tracked!(packed_bundled_libs, true); tracked!(panic_abort_tests, true); diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 79eb31bb105..419b6afe7c6 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -3048,9 +3048,9 @@ pub(crate) fn stable_hash( #[derive(Clone, Copy, PartialEq, Hash, Debug, Encodable, Decodable, HashStable_Generic)] pub enum OomStrategy { /// Generate a panic that can be caught by `catch_unwind`. - Panic, + Unwind, - /// Abort the process immediately. + /// Calls the panic hook as normal but aborts instead of unwinding. Abort, } @@ -3059,7 +3059,7 @@ impl OomStrategy { pub fn should_panic(self) -> u8 { match self { - OomStrategy::Panic => 1, + OomStrategy::Unwind => 1, OomStrategy::Abort => 0, } } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 631dd0a2146..46c992dfefd 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -662,7 +662,7 @@ pub(crate) fn parse_panic_strategy(slot: &mut PanicStrategy, v: Option<&str>) -> pub(crate) fn parse_oom_strategy(slot: &mut OomStrategy, v: Option<&str>) -> bool { match v { - Some("panic") => *slot = OomStrategy::Panic, + Some("unwind") => *slot = OomStrategy::Unwind, Some("abort") => *slot = OomStrategy::Abort, _ => return false, } diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index 97bedc604da..0db23e55a86 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -398,7 +398,7 @@ fn rust_oom(layout: Layout) -> ! { fn panic_impl(pi: &core::panic::PanicInfo<'_>) -> !; // This symbol is emitted by rustc . - // Its value depends on the -Zoom={panic,abort} compiler option. + // Its value depends on the -Zoom={unwind,abort} compiler option. static __rust_alloc_error_handler_should_panic: u8; } @@ -458,7 +458,7 @@ pub mod __alloc_error_handler { pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! { extern "Rust" { // This symbol is emitted by rustc next to __rust_alloc_error_handler. - // Its value depends on the -Zoom={panic,abort} compiler option. + // Its value depends on the -Zoom={unwind,abort} compiler option. static __rust_alloc_error_handler_should_panic: u8; } diff --git a/tests/ui/oom_unwind.rs b/tests/ui/oom_unwind.rs index 21a8fb2b22b..704d6f8b810 100644 --- a/tests/ui/oom_unwind.rs +++ b/tests/ui/oom_unwind.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z oom=panic +// compile-flags: -Z oom=unwind // run-pass // no-prefer-dynamic // needs-unwind