-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add more syscall doc aliases to std docs #113891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1922,7 +1922,7 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> { | |
/// Ok(()) | ||
/// } | ||
/// ``` | ||
#[doc(alias = "stat")] | ||
#[doc(alias = "stat", alias = "GetFileAttributes", alias = "GetFileAttributesEx")] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> { | ||
fs_imp::stat(path.as_ref()).map(Metadata) | ||
|
@@ -1957,7 +1957,7 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> { | |
/// Ok(()) | ||
/// } | ||
/// ``` | ||
#[doc(alias = "lstat")] | ||
#[doc(alias = "lstat", alias = "GetFileAttributes", alias = "GetFileAttributesEx")] | ||
#[stable(feature = "symlink_metadata", since = "1.1.0")] | ||
pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> { | ||
fs_imp::lstat(path.as_ref()).map(Metadata) | ||
|
@@ -2061,6 +2061,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> | |
/// } | ||
/// ``` | ||
#[doc(alias = "cp")] | ||
#[doc(alias = "copy_file_range")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another instance of breaking the doc alias policy, where |
||
#[doc(alias = "CopyFile", alias = "CopyFileEx")] | ||
#[doc(alias = "fclonefileat", alias = "fcopyfile")] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
|
@@ -2303,6 +2304,7 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> { | |
/// Ok(()) | ||
/// } | ||
/// ``` | ||
#[doc(alias = "mkdir", alias = "CreateDirectory")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another instance where we either choose to break the alias policy, or have to decide which one of |
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { | ||
DirBuilder::new().recursive(true).create(path.as_ref()) | ||
|
@@ -2386,6 +2388,7 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> { | |
/// Ok(()) | ||
/// } | ||
/// ``` | ||
#[doc(alias = "rm")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (seems like I forgot this one, it also breaks the policy). |
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { | ||
fs_imp::remove_dir_all(path.as_ref()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,6 +577,7 @@ impl FileTimesExt for fs::FileTimes { | |
/// the process as an administrator. | ||
/// | ||
/// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links | ||
#[doc(alias = "CreateSymbolicLink", alias = "CreateSymbolicLinkW")] | ||
#[stable(feature = "symlink", since = "1.1.0")] | ||
pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> { | ||
sys::fs::symlink_inner(original.as_ref(), link.as_ref(), false) | ||
|
@@ -616,6 +617,7 @@ pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io: | |
/// the process as an administrator. | ||
/// | ||
/// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links | ||
#[doc(alias = "CreateSymbolicLink", alias = "CreateSymbolicLinkW")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A case similar to the |
||
#[stable(feature = "symlink", since = "1.1.0")] | ||
pub fn symlink_dir<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> { | ||
sys::fs::symlink_inner(original.as_ref(), link.as_ref(), true) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Windows functions here break the doc alias policy, since
GetFileAttributes
is now mapped to multiple functions. We now have to weigh up the inconsistency of breaking the doc alias policy versus the inconsistency of offering the alises only on Unix.