From 38712030ca9d7844ca0ba606be493b4fda08dcaa Mon Sep 17 00:00:00 2001 From: Christopher Berner Date: Wed, 28 May 2025 21:01:04 -0700 Subject: [PATCH] Stabilize "file_lock" feature --- library/std/src/fs.rs | 25 ++++++++++--------------- src/tools/miri/src/lib.rs | 2 +- src/tools/miri/tests/pass/shims/fs.rs | 1 - 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 0cd794fd3efbb..865ea620a283f 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -121,7 +121,7 @@ pub struct File { /// /// [`try_lock`]: File::try_lock /// [`try_lock_shared`]: File::try_lock_shared -#[unstable(feature = "file_lock", issue = "130994")] +#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] pub enum TryLockError { /// The lock could not be acquired due to an I/O error on the file. The standard library will /// not return an [`ErrorKind::WouldBlock`] error inside [`TryLockError::Error`] @@ -366,10 +366,10 @@ pub fn write, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result inner(path.as_ref(), contents.as_ref()) } -#[unstable(feature = "file_lock", issue = "130994")] +#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] impl error::Error for TryLockError {} -#[unstable(feature = "file_lock", issue = "130994")] +#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] impl fmt::Debug for TryLockError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -379,7 +379,7 @@ impl fmt::Debug for TryLockError { } } -#[unstable(feature = "file_lock", issue = "130994")] +#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] impl fmt::Display for TryLockError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -390,7 +390,7 @@ impl fmt::Display for TryLockError { } } -#[unstable(feature = "file_lock", issue = "130994")] +#[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] impl From for io::Error { fn from(err: TryLockError) -> io::Error { match err { @@ -713,7 +713,6 @@ impl File { /// # Examples /// /// ```no_run - /// #![feature(file_lock)] /// use std::fs::File; /// /// fn main() -> std::io::Result<()> { @@ -722,7 +721,7 @@ impl File { /// Ok(()) /// } /// ``` - #[unstable(feature = "file_lock", issue = "130994")] + #[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] pub fn lock(&self) -> io::Result<()> { self.inner.lock() } @@ -766,7 +765,6 @@ impl File { /// # Examples /// /// ```no_run - /// #![feature(file_lock)] /// use std::fs::File; /// /// fn main() -> std::io::Result<()> { @@ -775,7 +773,7 @@ impl File { /// Ok(()) /// } /// ``` - #[unstable(feature = "file_lock", issue = "130994")] + #[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] pub fn lock_shared(&self) -> io::Result<()> { self.inner.lock_shared() } @@ -824,7 +822,6 @@ impl File { /// # Examples /// /// ```no_run - /// #![feature(file_lock)] /// use std::fs::{File, TryLockError}; /// /// fn main() -> std::io::Result<()> { @@ -840,7 +837,7 @@ impl File { /// Ok(()) /// } /// ``` - #[unstable(feature = "file_lock", issue = "130994")] + #[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] pub fn try_lock(&self) -> Result<(), TryLockError> { self.inner.try_lock() } @@ -888,7 +885,6 @@ impl File { /// # Examples /// /// ```no_run - /// #![feature(file_lock)] /// use std::fs::{File, TryLockError}; /// /// fn main() -> std::io::Result<()> { @@ -905,7 +901,7 @@ impl File { /// Ok(()) /// } /// ``` - #[unstable(feature = "file_lock", issue = "130994")] + #[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] pub fn try_lock_shared(&self) -> Result<(), TryLockError> { self.inner.try_lock_shared() } @@ -933,7 +929,6 @@ impl File { /// # Examples /// /// ```no_run - /// #![feature(file_lock)] /// use std::fs::File; /// /// fn main() -> std::io::Result<()> { @@ -943,7 +938,7 @@ impl File { /// Ok(()) /// } /// ``` - #[unstable(feature = "file_lock", issue = "130994")] + #[stable(feature = "file_lock", since = "CURRENT_RUSTC_VERSION")] pub fn unlock(&self) -> io::Result<()> { self.inner.unlock() } diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 344e12e9fa349..048ed81a816f8 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -16,7 +16,7 @@ #![feature(unqualified_local_imports)] #![feature(derive_coerce_pointee)] #![feature(arbitrary_self_types)] -#![feature(file_lock)] +#![cfg_attr(bootstrap, feature(file_lock))] // Configure clippy and other lints #![allow( clippy::collapsible_else_if, diff --git a/src/tools/miri/tests/pass/shims/fs.rs b/src/tools/miri/tests/pass/shims/fs.rs index 2f30827c9336b..9d5725773e647 100644 --- a/src/tools/miri/tests/pass/shims/fs.rs +++ b/src/tools/miri/tests/pass/shims/fs.rs @@ -2,7 +2,6 @@ #![feature(io_error_more)] #![feature(io_error_uncategorized)] -#![feature(file_lock)] use std::collections::BTreeMap; use std::ffi::OsString;