Skip to content

Commit c97d07e

Browse files
joshtriplettgitbot
authored and
gitbot
committed
Document that locking a file fails on Windows if the file is opened only for append
1 parent 69d5115 commit c97d07e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

std/src/fs.rs

+15
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,9 @@ impl File {
648648
/// and the `LockFileEx` function on Windows with the `LOCKFILE_EXCLUSIVE_LOCK` flag. Note that,
649649
/// this [may change in the future][changes].
650650
///
651+
/// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
652+
/// open it with either `.read(true).append(true)` or `.write(true)`.
653+
///
651654
/// [changes]: io#platform-specific-behavior
652655
///
653656
/// [`lock`]: File::lock
@@ -698,6 +701,9 @@ impl File {
698701
/// and the `LockFileEx` function on Windows. Note that, this
699702
/// [may change in the future][changes].
700703
///
704+
/// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
705+
/// open it with either `.read(true).append(true)` or `.write(true)`.
706+
///
701707
/// [changes]: io#platform-specific-behavior
702708
///
703709
/// [`lock`]: File::lock
@@ -753,6 +759,9 @@ impl File {
753759
/// and `LOCKFILE_FAIL_IMMEDIATELY` flags. Note that, this
754760
/// [may change in the future][changes].
755761
///
762+
/// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
763+
/// open it with either `.read(true).append(true)` or `.write(true)`.
764+
///
756765
/// [changes]: io#platform-specific-behavior
757766
///
758767
/// [`lock`]: File::lock
@@ -807,6 +816,9 @@ impl File {
807816
/// `LOCKFILE_FAIL_IMMEDIATELY` flag. Note that, this
808817
/// [may change in the future][changes].
809818
///
819+
/// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
820+
/// open it with either `.read(true).append(true)` or `.write(true)`.
821+
///
810822
/// [changes]: io#platform-specific-behavior
811823
///
812824
/// [`lock`]: File::lock
@@ -849,6 +861,9 @@ impl File {
849861
/// and the `UnlockFile` function on Windows. Note that, this
850862
/// [may change in the future][changes].
851863
///
864+
/// On Windows, locking a file will fail if the file is opened only for append. To lock a file,
865+
/// open it with either `.read(true).append(true)` or `.write(true)`.
866+
///
852867
/// [changes]: io#platform-specific-behavior
853868
///
854869
/// # Examples

0 commit comments

Comments
 (0)