Skip to content

Commit

Permalink
Auto merge of #113033 - JohnTitor:stabilize-unix-chown, r=cuviper
Browse files Browse the repository at this point in the history
Stabilize chown functions (`unix_chown`)

Closes #88989
FCP is complete here: rust-lang/rust#88989 (comment)
  • Loading branch information
bors committed Jul 22, 2023
2 parents bb72082 + 4cc63f6 commit f6d6191
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions std/src/os/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,14 @@ impl DirBuilderExt for fs::DirBuilder {
/// # Examples
///
/// ```no_run
/// #![feature(unix_chown)]
/// use std::os::unix::fs;
///
/// fn main() -> std::io::Result<()> {
/// fs::chown("/sandbox", Some(0), Some(0))?;
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_chown", issue = "88989")]
#[stable(feature = "unix_chown", since = "CURRENT_RUSTC_VERSION")]
pub fn chown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
sys::fs::chown(dir.as_ref(), uid.unwrap_or(u32::MAX), gid.unwrap_or(u32::MAX))
}
Expand All @@ -991,7 +990,6 @@ pub fn chown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::
/// # Examples
///
/// ```no_run
/// #![feature(unix_chown)]
/// use std::os::unix::fs;
///
/// fn main() -> std::io::Result<()> {
Expand All @@ -1000,7 +998,7 @@ pub fn chown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_chown", issue = "88989")]
#[stable(feature = "unix_chown", since = "CURRENT_RUSTC_VERSION")]
pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
sys::fs::fchown(fd.as_fd().as_raw_fd(), uid.unwrap_or(u32::MAX), gid.unwrap_or(u32::MAX))
}
Expand All @@ -1013,15 +1011,14 @@ pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<
/// # Examples
///
/// ```no_run
/// #![feature(unix_chown)]
/// use std::os::unix::fs;
///
/// fn main() -> std::io::Result<()> {
/// fs::lchown("/symlink", Some(0), Some(0))?;
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_chown", issue = "88989")]
#[stable(feature = "unix_chown", since = "CURRENT_RUSTC_VERSION")]
pub fn lchown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
sys::fs::lchown(dir.as_ref(), uid.unwrap_or(u32::MAX), gid.unwrap_or(u32::MAX))
}
Expand Down

0 comments on commit f6d6191

Please sign in to comment.