Rollup merge of #84709 - joshtriplett:doc-alias-chdir, r=dtolnay
Add doc alias for `chdir` to `std::env::set_current_dir` Searching for `chdir` in the Rust documentation produces no useful results. I wrote some code recently that called `libc::chdir` and manually handled errors, because I didn't realize that the safe `std::env::set_current_dir` existed. I searched for `chdir` and `change_dir` and `change_directory` (the latter two based on the precedent of unabbreviating set by `create_dir`), and I also read through `std::fs` expecting to potentially find it there. Given that none of those led to `std::env::set_current_dir`, I think that provides sufficient justification to add this specific alias.
This commit is contained in:
commit
4c4b3e81df
1 changed files with 1 additions and 0 deletions
|
@ -61,6 +61,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
|
||||||
/// assert!(env::set_current_dir(&root).is_ok());
|
/// assert!(env::set_current_dir(&root).is_ok());
|
||||||
/// println!("Successfully changed working directory to {}!", root.display());
|
/// println!("Successfully changed working directory to {}!", root.display());
|
||||||
/// ```
|
/// ```
|
||||||
|
#[doc(alias = "chdir")]
|
||||||
#[stable(feature = "env", since = "1.0.0")]
|
#[stable(feature = "env", since = "1.0.0")]
|
||||||
pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
|
pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
|
||||||
os_imp::chdir(path.as_ref())
|
os_imp::chdir(path.as_ref())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue