about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-08-31 10:41:17 +0200
committerGitHub <noreply@github.com>2021-08-31 10:41:17 +0200
commitcd20fbdf82d2f3caa4c8397ff62a23b5c701b4a9 (patch)
tree757bfe0507dbbbab9e5552b4b64744dc9af3759b
parentd4f263a558d065d73e21ef1505ac391caa651f5d (diff)
parent50da1eb1cddb6a6735d3601751f300d0773be65e (diff)
downloadrust-cd20fbdf82d2f3caa4c8397ff62a23b5c701b4a9.tar.gz
rust-cd20fbdf82d2f3caa4c8397ff62a23b5c701b4a9.zip
Rollup merge of #88394 - ChrisDenton:patch-1, r=joshtriplett
Document `std::env::current_exe` possible rename behaviour

It might not be obvious that the "path of the current running executable" may (or may not) imply "at the time it was loaded".

This came up recently in chat so I thought it might be worth documenting.
-rw-r--r--library/std/src/env.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/env.rs b/library/std/src/env.rs
index a7465200955..e343073d215 100644
--- a/library/std/src/env.rs
+++ b/library/std/src/env.rs
@@ -616,6 +616,9 @@ pub fn temp_dir() -> PathBuf {
 /// return the path of the symbolic link and other platforms will return the
 /// path of the symbolic link’s target.
 ///
+/// 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.
+///
 /// # Errors
 ///
 /// Acquiring the path of the current executable is a platform-specific operation