about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-10-23 05:28:28 +0200
committerGitHub <noreply@github.com>2021-10-23 05:28:28 +0200
commita05a1294d08e285f7039293298d9170fb3117013 (patch)
treea6530233d631c96befbf76a8dd965573a516f038
parent1ea34fb463b4472d674576b1d310cd44ce40760b (diff)
parentc736c2a3aef0069fc9af918bea841d35dfba7b7a (diff)
downloadrust-a05a1294d08e285f7039293298d9170fb3117013.tar.gz
rust-a05a1294d08e285f7039293298d9170fb3117013.zip
Rollup merge of #90166 - smmalis37:patch-1, r=joshtriplett
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();