Rollup merge of #138822 - moxian:unlock, r=joshtriplett

De-Stabilize `file_lock`

This reverts #136794

FCP on the tracking issue (#130994) passsed successfully https://github.com/rust-lang/rust/issues/130994#issuecomment-2646158607 but there are now concerns about the suitability of the proposed API (https://github.com/rust-lang/rust/issues/130994#issuecomment-2734608366)

On zullip it was [suggested](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/File.3A.3Atry_lock.20API.3A.20Result.3Cbool.3E/near/506823067) that it would be better to temporarily(?) destabilize the feature ASAP to buy us some more time reflecting on the API.

This PR implements the revert.

The feature is not currently on beta (https://github.com/rust-lang/rust/blob/beta/library/std/src/fs.rs#L672) so a beta backport is not yet neccessary.

If this revert is accepted, the tracking issue (#130994) should be reopened
This commit is contained in:
Matthias Krüger 2025-03-22 21:34:40 +01:00 committed by GitHub
commit 3f59916a30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -665,6 +665,7 @@ impl File {
/// # Examples
///
/// ```no_run
/// #![feature(file_lock)]
/// use std::fs::File;
///
/// fn main() -> std::io::Result<()> {
@ -673,7 +674,7 @@ impl File {
/// Ok(())
/// }
/// ```
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
#[unstable(feature = "file_lock", issue = "130994")]
pub fn lock(&self) -> io::Result<()> {
self.inner.lock()
}
@ -717,6 +718,7 @@ impl File {
/// # Examples
///
/// ```no_run
/// #![feature(file_lock)]
/// use std::fs::File;
///
/// fn main() -> std::io::Result<()> {
@ -725,7 +727,7 @@ impl File {
/// Ok(())
/// }
/// ```
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
#[unstable(feature = "file_lock", issue = "130994")]
pub fn lock_shared(&self) -> io::Result<()> {
self.inner.lock_shared()
}
@ -774,6 +776,7 @@ impl File {
/// # Examples
///
/// ```no_run
/// #![feature(file_lock)]
/// use std::fs::File;
///
/// fn main() -> std::io::Result<()> {
@ -782,7 +785,7 @@ impl File {
/// Ok(())
/// }
/// ```
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
#[unstable(feature = "file_lock", issue = "130994")]
pub fn try_lock(&self) -> io::Result<bool> {
self.inner.try_lock()
}
@ -830,6 +833,7 @@ impl File {
/// # Examples
///
/// ```no_run
/// #![feature(file_lock)]
/// use std::fs::File;
///
/// fn main() -> std::io::Result<()> {
@ -838,7 +842,7 @@ impl File {
/// Ok(())
/// }
/// ```
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
#[unstable(feature = "file_lock", issue = "130994")]
pub fn try_lock_shared(&self) -> io::Result<bool> {
self.inner.try_lock_shared()
}
@ -866,6 +870,7 @@ impl File {
/// # Examples
///
/// ```no_run
/// #![feature(file_lock)]
/// use std::fs::File;
///
/// fn main() -> std::io::Result<()> {
@ -875,7 +880,7 @@ impl File {
/// Ok(())
/// }
/// ```
#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")]
#[unstable(feature = "file_lock", issue = "130994")]
pub fn unlock(&self) -> io::Result<()> {
self.inner.unlock()
}