Skip to content

Change signature of File::try_lock and File::try_lock_shared #139343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2025

Conversation

cberner
Copy link
Contributor

@cberner cberner commented Apr 4, 2025

These methods now return Result<(), TryLockError> instead of Result<bool, Error> to make their use less errorprone

These methods are unstable under the "file_lock" feature. The related tracking issue is #130999 and this PR changes the signatures as discussed by libs-api: #130994 (comment)

@rustbot
Copy link
Collaborator

rustbot commented Apr 4, 2025

r? @Noratrieb

rustbot has assigned @Noratrieb.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 4, 2025
@cberner cberner force-pushed the filelock_wouldblock branch 2 times, most recently from 823b39d to e67d573 Compare April 5, 2025 00:05
@cberner cberner force-pushed the filelock_wouldblock branch from e67d573 to 7302f8e Compare April 6, 2025 15:48
@cberner
Copy link
Contributor Author

cberner commented Apr 6, 2025

Ok, I pushed a new commit to address the comments and also made the docs a little more clear for TryLockError::WouldBlock

@cberner
Copy link
Contributor Author

cberner commented Apr 21, 2025

@Noratrieb anything I can do to help move this PR forward?

@jieyouxu
Copy link
Member

r? libs

@rustbot rustbot assigned workingjubilee and unassigned Noratrieb Apr 25, 2025
@workingjubilee
Copy link
Member

Seems fine to me. People can continue to kibitz over what it should be if they want. @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 30, 2025

📌 Commit 7302f8e has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 30, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request May 1, 2025
…kingjubilee

Change signature of File::try_lock and File::try_lock_shared

These methods now return Result<(), TryLockError> instead of Result<bool, Error> to make their use less errorprone

These methods are unstable under the "file_lock" feature. The related tracking issue is rust-lang#130999 and this PR changes the signatures as discussed by libs-api: rust-lang#130994 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang#134034 (handle paren in macro expand for let-init-else expr)
 - rust-lang#138703 (chore: remove redundant words in comment)
 - rust-lang#139186 (Refactor `diy_float`)
 - rust-lang#139343 (Change signature of File::try_lock and File::try_lock_shared)
 - rust-lang#139780 (docs: Add example to `Iterator::take` with `by_ref`)
 - rust-lang#139802 (Fix some grammar errors and hyperlinks in doc for `trait Allocator`)
 - rust-lang#140034 (simd_select_bitmask: the 'padding' bits in the mask are just ignored)
 - rust-lang#140062 (std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into)
 - rust-lang#140485 (Optimize the codegen for `Span::from_expansion`)
 - rust-lang#140505 (linker: Quote symbol names in .def files)
 - rust-lang#140521 (interpret: better error message for out-of-bounds pointer arithmetic and accesses)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request May 1, 2025
…kingjubilee

Change signature of File::try_lock and File::try_lock_shared

These methods now return Result<(), TryLockError> instead of Result<bool, Error> to make their use less errorprone

These methods are unstable under the "file_lock" feature. The related tracking issue is rust-lang#130999 and this PR changes the signatures as discussed by libs-api: rust-lang#130994 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang#134034 (handle paren in macro expand for let-init-else expr)
 - rust-lang#138703 (chore: remove redundant words in comment)
 - rust-lang#139186 (Refactor `diy_float`)
 - rust-lang#139343 (Change signature of File::try_lock and File::try_lock_shared)
 - rust-lang#139780 (docs: Add example to `Iterator::take` with `by_ref`)
 - rust-lang#139802 (Fix some grammar errors and hyperlinks in doc for `trait Allocator`)
 - rust-lang#140034 (simd_select_bitmask: the 'padding' bits in the mask are just ignored)
 - rust-lang#140062 (std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into)
 - rust-lang#140485 (Optimize the codegen for `Span::from_expansion`)
 - rust-lang#140521 (interpret: better error message for out-of-bounds pointer arithmetic and accesses)

r? `@ghost`
`@rustbot` modify labels: rollup
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 1, 2025
…kingjubilee

Change signature of File::try_lock and File::try_lock_shared

These methods now return Result<(), TryLockError> instead of Result<bool, Error> to make their use less errorprone

These methods are unstable under the "file_lock" feature. The related tracking issue is rust-lang#130999 and this PR changes the signatures as discussed by libs-api: rust-lang#130994 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2025
…llaumeGomez

Rollup of 12 pull requests

Successful merges:

 - rust-lang#138703 (chore: remove redundant words in comment)
 - rust-lang#139186 (Refactor `diy_float`)
 - rust-lang#139343 (Change signature of File::try_lock and File::try_lock_shared)
 - rust-lang#139780 (docs: Add example to `Iterator::take` with `by_ref`)
 - rust-lang#139802 (Fix some grammar errors and hyperlinks in doc for `trait Allocator`)
 - rust-lang#140034 (simd_select_bitmask: the 'padding' bits in the mask are just ignored)
 - rust-lang#140062 (std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently written into)
 - rust-lang#140420 (rustdoc: Fix doctest heuristic for main fn wrapping)
 - rust-lang#140460 (Fix handling of LoongArch target features not supported by LLVM 19)
 - rust-lang#140538 (rustc-dev-guide subtree update)
 - rust-lang#140552 (allow `#[rustc_std_internal_symbol]` in combination with `#[naked]`)
 - rust-lang#140556 (Improve error output in case `nodejs` or `npm` is not installed for rustdoc-gui test suite)

r? `@ghost`
`@rustbot` modify labels: rollup
@GuillaumeGomez
Copy link
Member

Failed in #140562:

unused import: `TryLockError`
library/std/src/fs/tests.rs:4:53

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 1, 2025
@cberner cberner force-pushed the filelock_wouldblock branch 2 times, most recently from cbb8666 to c2f60fa Compare May 1, 2025 21:23
@workingjubilee
Copy link
Member

welp.

@cberner cberner force-pushed the filelock_wouldblock branch from c2f60fa to d891eb0 Compare May 1, 2025 22:26
@cberner
Copy link
Contributor Author

cberner commented May 1, 2025

Oops, my bad. I missed the #[cfg] for that import. I fixed it now, and also added one to the check_would_block macro definition. @workingjubilee can I trouble you for another stamp?

@cberner
Copy link
Contributor Author

cberner commented May 2, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 2, 2025
cberner added 2 commits May 1, 2025 20:39
These methods now return Result<(), TryLockError> instead of
Result<bool, Error> to make their use less errorprone
@cberner cberner force-pushed the filelock_wouldblock branch from d891eb0 to 1d11ee2 Compare May 2, 2025 03:39
@workingjubilee
Copy link
Member

Thanks! Let's try this again.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 2, 2025

📌 Commit 1d11ee2 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 2, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139343 (Change signature of File::try_lock and File::try_lock_shared)
 - rust-lang#140505 (linker: Quote symbol names in .def files)
 - rust-lang#140534 (PassWrapper: adapt for llvm/llvm-project@f137c3d592e96330e450a8fd63ef…)
 - rust-lang#140546 (Remove backtrace dep from anyhow in features status dump tool)
 - rust-lang#140548 (Emit user type annotations for free consts in pattern position)
 - rust-lang#140564 (Use present indicative tense in std::io::pipe() API docs)
 - rust-lang#140568 (Add regression test for rust-lang#140545)
 - rust-lang#140606 (Improve hir pretty printing)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 69e0844 into rust-lang:master May 3, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 3, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2025
Rollup merge of rust-lang#139343 - cberner:filelock_wouldblock, r=workingjubilee

Change signature of File::try_lock and File::try_lock_shared

These methods now return Result<(), TryLockError> instead of Result<bool, Error> to make their use less errorprone

These methods are unstable under the "file_lock" feature. The related tracking issue is rust-lang#130999 and this PR changes the signatures as discussed by libs-api: rust-lang#130994 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants