about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-02-11 17:51:30 +0100
committerJosh Triplett <josh@joshtriplett.org>2025-02-11 21:11:05 +0100
commitbc59397f8f320eefc5c2c60d1ad9fa816bbee2e4 (patch)
tree941970cd5797031d7dc7f784538e3d30fcb91bc1 /library/std/src
parent16abb39c9dd7e346ffecd5bf03c315bf374ece5f (diff)
downloadrust-bc59397f8f320eefc5c2c60d1ad9fa816bbee2e4.tar.gz
rust-bc59397f8f320eefc5c2c60d1ad9fa816bbee2e4.zip
Document that locking a file fails on Windows if the file is opened only for append
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/fs.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index 7c8279f2555..0707115cbdd 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -648,6 +648,9 @@ impl File {
     /// and the `LockFileEx` function on Windows with the `LOCKFILE_EXCLUSIVE_LOCK` flag. Note that,
     /// this [may change in the future][changes].
     ///
+    /// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
+    /// open it with either `.read(true).append(true)` or `.write(true)`.
+    ///
     /// [changes]: io#platform-specific-behavior
     ///
     /// [`lock`]: File::lock
@@ -698,6 +701,9 @@ impl File {
     /// and the `LockFileEx` function on Windows. Note that, this
     /// [may change in the future][changes].
     ///
+    /// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
+    /// open it with either `.read(true).append(true)` or `.write(true)`.
+    ///
     /// [changes]: io#platform-specific-behavior
     ///
     /// [`lock`]: File::lock
@@ -753,6 +759,9 @@ impl File {
     /// and `LOCKFILE_FAIL_IMMEDIATELY` flags. Note that, this
     /// [may change in the future][changes].
     ///
+    /// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
+    /// open it with either `.read(true).append(true)` or `.write(true)`.
+    ///
     /// [changes]: io#platform-specific-behavior
     ///
     /// [`lock`]: File::lock
@@ -807,6 +816,9 @@ impl File {
     /// `LOCKFILE_FAIL_IMMEDIATELY` flag. Note that, this
     /// [may change in the future][changes].
     ///
+    /// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
+    /// open it with either `.read(true).append(true)` or `.write(true)`.
+    ///
     /// [changes]: io#platform-specific-behavior
     ///
     /// [`lock`]: File::lock
@@ -849,6 +861,9 @@ impl File {
     /// and the `UnlockFile` function on Windows. Note that, this
     /// [may change in the future][changes].
     ///
+    /// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
+    /// open it with either `.read(true).append(true)` or `.write(true)`.
+    ///
     /// [changes]: io#platform-specific-behavior
     ///
     /// # Examples