about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2022-07-05 12:00:51 +0100
committerChris Denton <christophersdenton@gmail.com>2022-07-05 12:05:51 +0100
commit2d0650457f570ca3d0d1ff24092e71291155a8a6 (patch)
treea838525d59a470d24dfa14d5ea53dfc7d2a204cc
parent8d4adad953edef2ef94b02e2bb1ed9b22bb1d975 (diff)
downloadrust-2d0650457f570ca3d0d1ff24092e71291155a8a6.tar.gz
rust-2d0650457f570ca3d0d1ff24092e71291155a8a6.zip
Add comment and simplify `hiberfil_sys` test
-rw-r--r--library/std/src/fs/tests.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs
index e1ebb1a690b..d028204e5a1 100644
--- a/library/std/src/fs/tests.rs
+++ b/library/std/src/fs/tests.rs
@@ -1535,13 +1535,14 @@ fn read_large_dir() {
     }
 }
 
+/// Test the fallback for getting the metadata of files like hiberfil.sys that
+/// Windows holds a special lock on, preventing normal means of querying
+/// metadata. See #96980.
 #[test]
 #[cfg(windows)]
 fn hiberfil_sys() {
-    // Get the system drive, which is usually `C:`.
-    let mut hiberfil = crate::env::var("SystemDrive").unwrap();
-    hiberfil.push_str(r"\hiberfil.sys");
+    let hiberfil = r"C:\hiberfil.sys";
 
-    fs::metadata(&hiberfil).unwrap();
-    fs::symlink_metadata(&hiberfil).unwrap();
+    fs::metadata(hiberfil).unwrap();
+    fs::symlink_metadata(hiberfil).unwrap();
 }