From bcfc48db762ca4ce8758b5c8c4c52ee6e5ae5764 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Tue, 31 Oct 2023 10:26:03 +0800 Subject: [PATCH] Stabilize `file_set_times` Approved via FCP in https://github.com/rust-lang/rust/issues/98245 . --- library/std/src/fs.rs | 16 +++++++--------- library/std/src/os/ios/fs.rs | 6 +++--- library/std/src/os/macos/fs.rs | 6 +++--- library/std/src/os/watchos/fs.rs | 6 +++--- library/std/src/os/windows/fs.rs | 6 +++--- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index c44223a2f32..61c39133617 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -189,7 +189,7 @@ pub struct File { /// Representation of the various timestamps on a file. #[derive(Copy, Clone, Debug, Default)] -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub struct FileTimes(fs_imp::FileTimes); /// Representation of the various permissions on a file. @@ -676,8 +676,6 @@ pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> { /// # Examples /// /// ```no_run - /// #![feature(file_set_times)] - /// /// fn main() -> std::io::Result<()> { /// use std::fs::{self, File, FileTimes}; /// @@ -690,7 +688,7 @@ pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> { /// Ok(()) /// } /// ``` - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] #[doc(alias = "futimens")] #[doc(alias = "futimes")] #[doc(alias = "SetFileTime")] @@ -701,7 +699,7 @@ pub fn set_times(&self, times: FileTimes) -> io::Result<()> { /// Changes the modification time of the underlying file. /// /// This is an alias for `set_times(FileTimes::new().set_modified(time))`. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] #[inline] pub fn set_modified(&self, time: SystemTime) -> io::Result<()> { self.set_times(FileTimes::new().set_modified(time)) @@ -1415,20 +1413,20 @@ impl FileTimes { /// Create a new `FileTimes` with no times set. /// /// Using the resulting `FileTimes` in [`File::set_times`] will not modify any timestamps. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub fn new() -> Self { Self::default() } /// Set the last access time of a file. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub fn set_accessed(mut self, t: SystemTime) -> Self { self.0.set_accessed(t.into_inner()); self } /// Set the last modified time of a file. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub fn set_modified(mut self, t: SystemTime) -> Self { self.0.set_modified(t.into_inner()); self @@ -1442,7 +1440,7 @@ fn as_inner_mut(&mut self) -> &mut fs_imp::FileTimes { } // For implementing OS extension traits in `std::os` -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] impl Sealed for FileTimes {} impl Permissions { diff --git a/library/std/src/os/ios/fs.rs b/library/std/src/os/ios/fs.rs index b319527a541..0d2a7189032 100644 --- a/library/std/src/os/ios/fs.rs +++ b/library/std/src/os/ios/fs.rs @@ -144,14 +144,14 @@ fn st_lspare(&self) -> u32 { } /// OS-specific extensions to [`fs::FileTimes`]. -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub trait FileTimesExt: Sealed { /// Set the creation time of a file. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] fn set_created(self, t: SystemTime) -> Self; } -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] impl FileTimesExt for fs::FileTimes { fn set_created(mut self, t: SystemTime) -> Self { self.as_inner_mut().set_created(t.into_inner()); diff --git a/library/std/src/os/macos/fs.rs b/library/std/src/os/macos/fs.rs index fe82d03d869..098b0733723 100644 --- a/library/std/src/os/macos/fs.rs +++ b/library/std/src/os/macos/fs.rs @@ -150,14 +150,14 @@ fn st_lspare(&self) -> u32 { } /// OS-specific extensions to [`fs::FileTimes`]. -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub trait FileTimesExt: Sealed { /// Set the creation time of a file. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] fn set_created(self, t: SystemTime) -> Self; } -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] impl FileTimesExt for fs::FileTimes { fn set_created(mut self, t: SystemTime) -> Self { self.as_inner_mut().set_created(t.into_inner()); diff --git a/library/std/src/os/watchos/fs.rs b/library/std/src/os/watchos/fs.rs index 2ecc4c68a96..2838501817c 100644 --- a/library/std/src/os/watchos/fs.rs +++ b/library/std/src/os/watchos/fs.rs @@ -144,14 +144,14 @@ fn st_lspare(&self) -> u32 { } /// OS-specific extensions to [`fs::FileTimes`]. -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub trait FileTimesExt: Sealed { /// Set the creation time of a file. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] fn set_created(self, t: SystemTime) -> Self; } -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] impl FileTimesExt for fs::FileTimes { fn set_created(mut self, t: SystemTime) -> Self { self.as_inner_mut().set_created(t.into_inner()); diff --git a/library/std/src/os/windows/fs.rs b/library/std/src/os/windows/fs.rs index 94509e54796..3b591a35dd7 100644 --- a/library/std/src/os/windows/fs.rs +++ b/library/std/src/os/windows/fs.rs @@ -528,14 +528,14 @@ fn is_symlink_file(&self) -> bool { } /// Windows-specific extensions to [`fs::FileTimes`]. -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] pub trait FileTimesExt: Sealed { /// Set the creation time of a file. - #[unstable(feature = "file_set_times", issue = "98245")] + #[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] fn set_created(self, t: SystemTime) -> Self; } -#[unstable(feature = "file_set_times", issue = "98245")] +#[stable(feature = "file_set_times", since = "CURRENT_RUSTC_VERSION")] impl FileTimesExt for fs::FileTimes { fn set_created(mut self, t: SystemTime) -> Self { self.as_inner_mut().set_created(t.into_inner());