From af83a9613c00b358b5a969e4bcffd6842f87588d Mon Sep 17 00:00:00 2001 From: Jade Date: Sat, 28 Aug 2021 12:47:04 -0700 Subject: [PATCH 1/2] std: Stabilize command_access Tracking issue: #44434 --- library/std/src/process.rs | 20 ++++++++------------ library/std/src/sys_common/process.rs | 6 +++--- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/library/std/src/process.rs b/library/std/src/process.rs index c9b21fcf9c6d2..9b915c6e8e7ea 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -115,7 +115,7 @@ use crate::path::Path; use crate::str; use crate::sys::pipe::{read2, AnonPipe}; use crate::sys::process as imp; -#[unstable(feature = "command_access", issue = "44434")] +#[stable(feature = "command_access", since = "1.56.0")] pub use crate::sys_common::process::CommandEnvs; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; @@ -943,13 +943,12 @@ impl Command { /// # Examples /// /// ``` - /// # #![feature(command_access)] /// use std::process::Command; /// /// let cmd = Command::new("echo"); /// assert_eq!(cmd.get_program(), "echo"); /// ``` - #[unstable(feature = "command_access", issue = "44434")] + #[stable(feature = "command_access", since = "1.56.0")] pub fn get_program(&self) -> &OsStr { self.inner.get_program() } @@ -963,7 +962,6 @@ impl Command { /// # Examples /// /// ``` - /// # #![feature(command_access)] /// use std::ffi::OsStr; /// use std::process::Command; /// @@ -972,7 +970,7 @@ impl Command { /// let args: Vec<&OsStr> = cmd.get_args().collect(); /// assert_eq!(args, &["first", "second"]); /// ``` - #[unstable(feature = "command_access", issue = "44434")] + #[stable(feature = "command_access", since = "1.56.0")] pub fn get_args(&self) -> CommandArgs<'_> { CommandArgs { inner: self.inner.get_args() } } @@ -992,7 +990,6 @@ impl Command { /// # Examples /// /// ``` - /// # #![feature(command_access)] /// use std::ffi::OsStr; /// use std::process::Command; /// @@ -1004,7 +1001,7 @@ impl Command { /// (OsStr::new("TZ"), None) /// ]); /// ``` - #[unstable(feature = "command_access", issue = "44434")] + #[stable(feature = "command_access", since = "1.56.0")] pub fn get_envs(&self) -> CommandEnvs<'_> { self.inner.get_envs() } @@ -1016,7 +1013,6 @@ impl Command { /// # Examples /// /// ``` - /// # #![feature(command_access)] /// use std::path::Path; /// use std::process::Command; /// @@ -1025,7 +1021,7 @@ impl Command { /// cmd.current_dir("/bin"); /// assert_eq!(cmd.get_current_dir(), Some(Path::new("/bin"))); /// ``` - #[unstable(feature = "command_access", issue = "44434")] + #[stable(feature = "command_access", since = "1.56.0")] pub fn get_current_dir(&self) -> Option<&Path> { self.inner.get_current_dir() } @@ -1057,13 +1053,13 @@ impl AsInnerMut for Command { /// /// This struct is created by [`Command::get_args`]. See its documentation for /// more. -#[unstable(feature = "command_access", issue = "44434")] +#[stable(feature = "command_access", since = "1.56.0")] #[derive(Debug)] pub struct CommandArgs<'a> { inner: imp::CommandArgs<'a>, } -#[unstable(feature = "command_access", issue = "44434")] +#[stable(feature = "command_access", since = "1.56.0")] impl<'a> Iterator for CommandArgs<'a> { type Item = &'a OsStr; fn next(&mut self) -> Option<&'a OsStr> { @@ -1074,7 +1070,7 @@ impl<'a> Iterator for CommandArgs<'a> { } } -#[unstable(feature = "command_access", issue = "44434")] +#[stable(feature = "command_access", since = "1.56.0")] impl<'a> ExactSizeIterator for CommandArgs<'a> { fn len(&self) -> usize { self.inner.len() diff --git a/library/std/src/sys_common/process.rs b/library/std/src/sys_common/process.rs index 38007d5c414ec..124f27d26409f 100644 --- a/library/std/src/sys_common/process.rs +++ b/library/std/src/sys_common/process.rs @@ -106,13 +106,13 @@ impl CommandEnv { /// This struct is created by /// [`Command::get_envs`][crate::process::Command::get_envs]. See its /// documentation for more. -#[unstable(feature = "command_access", issue = "44434")] +#[stable(feature = "command_access", since = "1.56.0")] #[derive(Debug)] pub struct CommandEnvs<'a> { iter: crate::collections::btree_map::Iter<'a, EnvKey, Option>, } -#[unstable(feature = "command_access", issue = "44434")] +#[stable(feature = "command_access", since = "1.56.0")] impl<'a> Iterator for CommandEnvs<'a> { type Item = (&'a OsStr, Option<&'a OsStr>); fn next(&mut self) -> Option { @@ -123,7 +123,7 @@ impl<'a> Iterator for CommandEnvs<'a> { } } -#[unstable(feature = "command_access", issue = "44434")] +#[stable(feature = "command_access", since = "1.56.0")] impl<'a> ExactSizeIterator for CommandEnvs<'a> { fn len(&self) -> usize { self.iter.len() From 5e1941c058f4437c7a7b03b76d96d3d6d5c8aa3d Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Tue, 5 Oct 2021 15:09:11 -0700 Subject: [PATCH 2/2] Apply suggestions from code review --- library/std/src/process.rs | 16 ++++++++-------- library/std/src/sys_common/process.rs | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 9b915c6e8e7ea..0be261cbd0b2d 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -115,7 +115,7 @@ use crate::path::Path; use crate::str; use crate::sys::pipe::{read2, AnonPipe}; use crate::sys::process as imp; -#[stable(feature = "command_access", since = "1.56.0")] +#[stable(feature = "command_access", since = "1.57.0")] pub use crate::sys_common::process::CommandEnvs; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; @@ -948,7 +948,7 @@ impl Command { /// let cmd = Command::new("echo"); /// assert_eq!(cmd.get_program(), "echo"); /// ``` - #[stable(feature = "command_access", since = "1.56.0")] + #[stable(feature = "command_access", since = "1.57.0")] pub fn get_program(&self) -> &OsStr { self.inner.get_program() } @@ -970,7 +970,7 @@ impl Command { /// let args: Vec<&OsStr> = cmd.get_args().collect(); /// assert_eq!(args, &["first", "second"]); /// ``` - #[stable(feature = "command_access", since = "1.56.0")] + #[stable(feature = "command_access", since = "1.57.0")] pub fn get_args(&self) -> CommandArgs<'_> { CommandArgs { inner: self.inner.get_args() } } @@ -1001,7 +1001,7 @@ impl Command { /// (OsStr::new("TZ"), None) /// ]); /// ``` - #[stable(feature = "command_access", since = "1.56.0")] + #[stable(feature = "command_access", since = "1.57.0")] pub fn get_envs(&self) -> CommandEnvs<'_> { self.inner.get_envs() } @@ -1021,7 +1021,7 @@ impl Command { /// cmd.current_dir("/bin"); /// assert_eq!(cmd.get_current_dir(), Some(Path::new("/bin"))); /// ``` - #[stable(feature = "command_access", since = "1.56.0")] + #[stable(feature = "command_access", since = "1.57.0")] pub fn get_current_dir(&self) -> Option<&Path> { self.inner.get_current_dir() } @@ -1053,13 +1053,13 @@ impl AsInnerMut for Command { /// /// This struct is created by [`Command::get_args`]. See its documentation for /// more. -#[stable(feature = "command_access", since = "1.56.0")] +#[stable(feature = "command_access", since = "1.57.0")] #[derive(Debug)] pub struct CommandArgs<'a> { inner: imp::CommandArgs<'a>, } -#[stable(feature = "command_access", since = "1.56.0")] +#[stable(feature = "command_access", since = "1.57.0")] impl<'a> Iterator for CommandArgs<'a> { type Item = &'a OsStr; fn next(&mut self) -> Option<&'a OsStr> { @@ -1070,7 +1070,7 @@ impl<'a> Iterator for CommandArgs<'a> { } } -#[stable(feature = "command_access", since = "1.56.0")] +#[stable(feature = "command_access", since = "1.57.0")] impl<'a> ExactSizeIterator for CommandArgs<'a> { fn len(&self) -> usize { self.inner.len() diff --git a/library/std/src/sys_common/process.rs b/library/std/src/sys_common/process.rs index 124f27d26409f..3d71219756a20 100644 --- a/library/std/src/sys_common/process.rs +++ b/library/std/src/sys_common/process.rs @@ -106,13 +106,13 @@ impl CommandEnv { /// This struct is created by /// [`Command::get_envs`][crate::process::Command::get_envs]. See its /// documentation for more. -#[stable(feature = "command_access", since = "1.56.0")] +#[stable(feature = "command_access", since = "1.57.0")] #[derive(Debug)] pub struct CommandEnvs<'a> { iter: crate::collections::btree_map::Iter<'a, EnvKey, Option>, } -#[stable(feature = "command_access", since = "1.56.0")] +#[stable(feature = "command_access", since = "1.57.0")] impl<'a> Iterator for CommandEnvs<'a> { type Item = (&'a OsStr, Option<&'a OsStr>); fn next(&mut self) -> Option { @@ -123,7 +123,7 @@ impl<'a> Iterator for CommandEnvs<'a> { } } -#[stable(feature = "command_access", since = "1.56.0")] +#[stable(feature = "command_access", since = "1.57.0")] impl<'a> ExactSizeIterator for CommandEnvs<'a> { fn len(&self) -> usize { self.iter.len()