From a6093701437be909614bc49d63406dfaa63d3b13 Mon Sep 17 00:00:00 2001 From: Zachary S Date: Fri, 5 Jul 2024 16:59:57 -0500 Subject: [PATCH] Move exit guard from sys::common::exit_guard to sys::exit_guard. --- library/std/src/rt.rs | 3 +-- library/std/src/sys/{pal/common => }/exit_guard.rs | 0 library/std/src/sys/mod.rs | 1 + library/std/src/sys/pal/common/mod.rs | 1 - library/std/src/sys/pal/unix/os.rs | 2 +- 5 files changed, 3 insertions(+), 4 deletions(-) rename library/std/src/sys/{pal/common => }/exit_guard.rs (100%) diff --git a/library/std/src/rt.rs b/library/std/src/rt.rs index 8a6f3fe291a7..c0a1c5f5594a 100644 --- a/library/std/src/rt.rs +++ b/library/std/src/rt.rs @@ -146,8 +146,7 @@ fn lang_start_internal( panic::catch_unwind(cleanup).map_err(rt_abort)?; // Guard against multple threads calling `libc::exit` concurrently. // See the documentation for `unique_thread_exit` for more information. - panic::catch_unwind(|| crate::sys::common::exit_guard::unique_thread_exit()) - .map_err(rt_abort)?; + panic::catch_unwind(|| crate::sys::exit_guard::unique_thread_exit()).map_err(rt_abort)?; ret_code } diff --git a/library/std/src/sys/pal/common/exit_guard.rs b/library/std/src/sys/exit_guard.rs similarity index 100% rename from library/std/src/sys/pal/common/exit_guard.rs rename to library/std/src/sys/exit_guard.rs diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs index 8aa35c40fe05..22ebc979bf7e 100644 --- a/library/std/src/sys/mod.rs +++ b/library/std/src/sys/mod.rs @@ -3,6 +3,7 @@ /// descriptors. mod pal; +pub(crate) mod exit_guard; mod personality; pub mod backtrace; diff --git a/library/std/src/sys/pal/common/mod.rs b/library/std/src/sys/pal/common/mod.rs index cc1dceb63e2f..29fc0835d766 100644 --- a/library/std/src/sys/pal/common/mod.rs +++ b/library/std/src/sys/pal/common/mod.rs @@ -11,7 +11,6 @@ #![allow(dead_code)] pub mod alloc; -pub mod exit_guard; pub mod small_c_string; #[cfg(test)] diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs index 3f598a095c15..397a0debe58c 100644 --- a/library/std/src/sys/pal/unix/os.rs +++ b/library/std/src/sys/pal/unix/os.rs @@ -758,7 +758,7 @@ pub fn home_dir() -> Option { } pub fn exit(code: i32) -> ! { - crate::sys::common::exit_guard::unique_thread_exit(); + crate::sys::exit_guard::unique_thread_exit(); unsafe { libc::exit(code as c_int) } }