Skip to content

Change File::try_lock() and try_lock_shared() to return io::Result<()> #140718

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

Closed
wants to merge 2 commits into from

Conversation

cberner
Copy link
Contributor

@cberner cberner commented May 6, 2025

This PR changes the signatures of File::try_lock and File::try_lock_shared as requested by @rust-lang/libs-api in this discussion: #130994 (comment)

These methods are unstable under the "file_lock" feature. The related tracking issue is #130994

@rustbot
Copy link
Collaborator

rustbot commented May 6, 2025

r? @thomcc

rustbot has assigned @thomcc.
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 May 6, 2025
@joshtriplett
Copy link
Member

This looks good to me, pending the question about Windows.

@rustbot rustbot added the O-windows Operating system: Windows label May 7, 2025
@cberner
Copy link
Contributor Author

cberner commented May 13, 2025

I think the question about Windows has been resolved now.

r? @joshtriplett

@rustbot rustbot assigned joshtriplett and unassigned thomcc May 13, 2025
try_lock() and try_lock_shared() do not need to handle these per the discussion in rust-lang#140718 (comment)
cberner added a commit to cberner/rust that referenced this pull request May 20, 2025
try_lock() and try_lock_shared() do not need to handle these per the discussion in rust-lang#140718 (comment)
cberner added a commit to cberner/rust that referenced this pull request May 20, 2025
try_lock() and try_lock_shared() do not need to handle these per the discussion in rust-lang#140718 (comment)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 27, 2025
Add From<TryLockError> for io::Error

Adds a `From` impl to make error propagation easier, as discussed in the tracking issue

`TryLockError` is unstable under the "file_lock" feature. The related tracking issue is rust-lang#130994

This PR also cleanups the Windows implementation of `try_lock()` and `try_lock_shared()` as [discussed here](rust-lang#140718 (comment))
rust-timer added a commit that referenced this pull request May 27, 2025
Rollup merge of #141312 - cberner:filelock_from, r=joshtriplett

Add From<TryLockError> for io::Error

Adds a `From` impl to make error propagation easier, as discussed in the tracking issue

`TryLockError` is unstable under the "file_lock" feature. The related tracking issue is #130994

This PR also cleanups the Windows implementation of `try_lock()` and `try_lock_shared()` as [discussed here](#140718 (comment))
@Amanieu
Copy link
Member

Amanieu commented May 27, 2025

Closing since the libs-api team decided to stay with the previous API in the end.

@Amanieu Amanieu closed this May 27, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request May 28, 2025
Add From<TryLockError> for io::Error

Adds a `From` impl to make error propagation easier, as discussed in the tracking issue

`TryLockError` is unstable under the "file_lock" feature. The related tracking issue is rust-lang/rust#130994

This PR also cleanups the Windows implementation of `try_lock()` and `try_lock_shared()` as [discussed here](rust-lang/rust#140718 (comment))
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request May 30, 2025
try_lock() and try_lock_shared() do not need to handle these per the discussion in rust-lang#140718 (comment)
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request May 30, 2025
Add From<TryLockError> for io::Error

Adds a `From` impl to make error propagation easier, as discussed in the tracking issue

`TryLockError` is unstable under the "file_lock" feature. The related tracking issue is rust-lang#130994

This PR also cleanups the Windows implementation of `try_lock()` and `try_lock_shared()` as [discussed here](rust-lang#140718 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants