From 26a15457357c292aa1f6b4e0fd415dd0da6403d7 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Thu, 8 Jan 2026 07:39:27 -0800 Subject: [PATCH] Document that Linux can add `" (deleted)"` Link to warning that platform-specific behavior is subject to change --- library/std/src/env.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/std/src/env.rs b/library/std/src/env.rs index 047dfbe1a2333..9a861e9e0e8ab 100644 --- a/library/std/src/env.rs +++ b/library/std/src/env.rs @@ -716,6 +716,11 @@ pub fn temp_dir() -> PathBuf { /// If the executable is renamed while it is running, platforms may return the /// path at the time it was loaded instead of the new path. /// +/// On Linux, if the executable is deleted while it is running, this function +/// may return the path with the string `" (deleted)"` appended. +/// +/// Note that the platform-specific behavior [may change in the future][changes]. +/// /// # Errors /// /// Acquiring the path of the current executable is a platform-specific operation @@ -751,6 +756,8 @@ pub fn temp_dir() -> PathBuf { /// Err(e) => println!("failed to get current exe path: {e}"), /// }; /// ``` +/// +/// [changes]: crate::io#platform-specific-behavior #[stable(feature = "env", since = "1.0.0")] pub fn current_exe() -> io::Result { paths_imp::current_exe()