about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteven <smmalis37@gmail.com>2021-10-22 09:55:32 -0400
committerGitHub <noreply@github.com>2021-10-22 09:55:32 -0400
commitc736c2a3aef0069fc9af918bea841d35dfba7b7a (patch)
tree866c78fe1a7c5908a6994c1d285b67c6a7e58ea2
parent68a698baf6bfc61d85ce6e25122a092c60c7f21a (diff)
downloadrust-c736c2a3aef0069fc9af918bea841d35dfba7b7a.tar.gz
rust-c736c2a3aef0069fc9af918bea841d35dfba7b7a.zip
Add comment documenting why we can't use a simpler solution
See #90144 for context.

r? @joshtriplett
-rw-r--r--library/std/src/sys/windows/os.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/sys/windows/os.rs b/library/std/src/sys/windows/os.rs
index 883690c4831..b5209aa690b 100644
--- a/library/std/src/sys/windows/os.rs
+++ b/library/std/src/sys/windows/os.rs
@@ -281,6 +281,10 @@ pub fn temp_dir() -> PathBuf {
 #[cfg(not(target_vendor = "uwp"))]
 fn home_dir_crt() -> Option<PathBuf> {
     unsafe {
+        // The magic constant -4 can be used as the token passed to GetUserProfileDirectoryW below
+        // instead of us having to go through these multiple steps to get a token. However this is
+        // not implemented on Windows 7, only Windows 8 and up. When we drop support for Windows 7
+        // we can simplify this code. See #90144 for details.
         use crate::sys::handle::Handle;
 
         let me = c::GetCurrentProcess();