Skip to content

Commit 32efb9f

Browse files
committed
Add more syscall doc aliases to std docs
1 parent 6b53175 commit 32efb9f

File tree

8 files changed

+53
-3
lines changed

8 files changed

+53
-3
lines changed

library/std/src/env.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
7878
/// assert!(env::set_current_dir(&root).is_ok());
7979
/// println!("Successfully changed working directory to {}!", root.display());
8080
/// ```
81-
#[doc(alias = "chdir")]
81+
#[doc(alias = "chdir", alias = "SetCurrentDirectory", alias = "SetCurrentDirectoryW")]
8282
#[stable(feature = "env", since = "1.0.0")]
8383
pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
8484
os_imp::chdir(path.as_ref())
@@ -623,6 +623,7 @@ pub fn home_dir() -> Option<PathBuf> {
623623
/// }
624624
/// ```
625625
#[must_use]
626+
#[doc(alias = "GetTempPath", alias = "GetTempPath2")]
626627
#[stable(feature = "env", since = "1.0.0")]
627628
pub fn temp_dir() -> PathBuf {
628629
os_imp::temp_dir()

library/std/src/fs.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ impl File {
646646
///
647647
/// Note that this method alters the permissions of the underlying file,
648648
/// even though it takes `&self` rather than `&mut self`.
649+
#[doc(alias = "fchmod", alias = "chmod", alias = "SetFileInformationByHandle")]
649650
#[stable(feature = "set_permissions_atomic", since = "1.16.0")]
650651
pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> {
651652
self.inner.set_permissions(perm.0)
@@ -1300,6 +1301,7 @@ impl Metadata {
13001301
/// Ok(())
13011302
/// }
13021303
/// ```
1304+
#[doc(alias = "mtime", alias = "ftLastWriteTime")]
13031305
#[stable(feature = "fs_time", since = "1.10.0")]
13041306
pub fn modified(&self) -> io::Result<SystemTime> {
13051307
self.0.modified().map(FromInner::from_inner)
@@ -1335,6 +1337,7 @@ impl Metadata {
13351337
/// Ok(())
13361338
/// }
13371339
/// ```
1340+
#[doc(alias = "atime", alias = "ftLastAccessTime")]
13381341
#[stable(feature = "fs_time", since = "1.10.0")]
13391342
pub fn accessed(&self) -> io::Result<SystemTime> {
13401343
self.0.accessed().map(FromInner::from_inner)
@@ -1367,6 +1370,7 @@ impl Metadata {
13671370
/// Ok(())
13681371
/// }
13691372
/// ```
1373+
#[doc(alias = "btime", alias = "birthtime", alias = "ftCreationTime")]
13701374
#[stable(feature = "fs_time", since = "1.10.0")]
13711375
pub fn created(&self) -> io::Result<SystemTime> {
13721376
self.0.created().map(FromInner::from_inner)
@@ -1865,6 +1869,7 @@ impl AsInner<fs_imp::DirEntry> for DirEntry {
18651869
/// Ok(())
18661870
/// }
18671871
/// ```
1872+
#[doc(alias = "rm", alias = "unlink", alias = "DeleteFile")]
18681873
#[stable(feature = "rust1", since = "1.0.0")]
18691874
pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
18701875
fs_imp::unlink(path.as_ref())
@@ -1903,6 +1908,7 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
19031908
/// Ok(())
19041909
/// }
19051910
/// ```
1911+
#[doc(alias = "stat", alias = "GetFileAttributes", alias = "GetFileAttributesEx")]
19061912
#[stable(feature = "rust1", since = "1.0.0")]
19071913
pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
19081914
fs_imp::stat(path.as_ref()).map(Metadata)
@@ -1937,6 +1943,7 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
19371943
/// Ok(())
19381944
/// }
19391945
/// ```
1946+
#[doc(alias = "lstat", alias = "GetFileAttributes", alias = "GetFileAttributesEx")]
19401947
#[stable(feature = "symlink_metadata", since = "1.1.0")]
19411948
pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
19421949
fs_imp::lstat(path.as_ref()).map(Metadata)
@@ -1980,6 +1987,7 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
19801987
/// Ok(())
19811988
/// }
19821989
/// ```
1990+
#[doc(alias = "mv", alias = "MoveFile", alias = "MoveFileEx")]
19831991
#[stable(feature = "rust1", since = "1.0.0")]
19841992
pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {
19851993
fs_imp::rename(from.as_ref(), to.as_ref())
@@ -2038,6 +2046,10 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
20382046
/// Ok(())
20392047
/// }
20402048
/// ```
2049+
#[doc(alias = "cp")]
2050+
#[doc(alias = "copy_file_range")]
2051+
#[doc(alias = "CopyFile", alias = "CopyFileEx")]
2052+
#[doc(alias = "fclonefileat", alias = "fcopyfile")]
20412053
#[stable(feature = "rust1", since = "1.0.0")]
20422054
pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
20432055
fs_imp::copy(from.as_ref(), to.as_ref())
@@ -2082,6 +2094,7 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
20822094
/// Ok(())
20832095
/// }
20842096
/// ```
2097+
#[doc(alias = "ln", alias = "CreateHardLink", alias = "linkat")]
20852098
#[stable(feature = "rust1", since = "1.0.0")]
20862099
pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> {
20872100
fs_imp::link(original.as_ref(), link.as_ref())
@@ -2231,7 +2244,7 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
22312244
/// Ok(())
22322245
/// }
22332246
/// ```
2234-
#[doc(alias = "mkdir")]
2247+
#[doc(alias = "mkdir", alias = "CreateDirectory")]
22352248
#[stable(feature = "rust1", since = "1.0.0")]
22362249
pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
22372250
DirBuilder::new().create(path.as_ref())
@@ -2276,6 +2289,7 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
22762289
/// Ok(())
22772290
/// }
22782291
/// ```
2292+
#[doc(alias = "mkdir", alias = "CreateDirectory")]
22792293
#[stable(feature = "rust1", since = "1.0.0")]
22802294
pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
22812295
DirBuilder::new().recursive(true).create(path.as_ref())
@@ -2311,7 +2325,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
23112325
/// Ok(())
23122326
/// }
23132327
/// ```
2314-
#[doc(alias = "rmdir")]
2328+
#[doc(alias = "rmdir", alias = "RemoveDirectory")]
23152329
#[stable(feature = "rust1", since = "1.0.0")]
23162330
pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
23172331
fs_imp::rmdir(path.as_ref())
@@ -2359,6 +2373,7 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
23592373
/// Ok(())
23602374
/// }
23612375
/// ```
2376+
#[doc(alias = "rm")]
23622377
#[stable(feature = "rust1", since = "1.0.0")]
23632378
pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
23642379
fs_imp::remove_dir_all(path.as_ref())
@@ -2434,6 +2449,7 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
24342449
/// Ok(())
24352450
/// }
24362451
/// ```
2452+
#[doc(alias = "ls", alias = "opendir", alias = "FindFirstFile", alias = "FindNextFile")]
24372453
#[stable(feature = "rust1", since = "1.0.0")]
24382454
pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
24392455
fs_imp::readdir(path.as_ref()).map(ReadDir)
@@ -2469,6 +2485,7 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
24692485
/// Ok(())
24702486
/// }
24712487
/// ```
2488+
#[doc(alias = "chmod", alias = "SetFileAttributes")]
24722489
#[stable(feature = "set_permissions", since = "1.1.0")]
24732490
pub fn set_permissions<P: AsRef<Path>>(path: P, perm: Permissions) -> io::Result<()> {
24742491
fs_imp::set_perm(path.as_ref(), perm.0)

library/std/src/io/copy.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ mod tests;
5656
/// Note that platform-specific behavior [may change in the future][changes].
5757
///
5858
/// [changes]: crate::io#platform-specific-behavior
59+
#[doc(alias = "copy_file_range", alias = "sendfile", alias = "splice")]
5960
#[stable(feature = "rust1", since = "1.0.0")]
6061
pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> Result<u64>
6162
where

library/std/src/net/tcp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ impl TcpStream {
601601
/// };
602602
/// println!("bytes: {buf:?}");
603603
/// ```
604+
#[doc(alias = "fcntl", alias = "ioctlsocket", alias = "FIONBIO")]
604605
#[stable(feature = "net2_mutators", since = "1.9.0")]
605606
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
606607
self.0.set_nonblocking(nonblocking)
@@ -1008,6 +1009,7 @@ impl TcpListener {
10081009
/// }
10091010
/// }
10101011
/// ```
1012+
#[doc(alias = "fcntl", alias = "ioctlsocket", alias = "FIONBIO")]
10111013
#[stable(feature = "net2_mutators", since = "1.9.0")]
10121014
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
10131015
self.0.set_nonblocking(nonblocking)

library/std/src/net/udp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,7 @@ impl UdpSocket {
784784
/// };
785785
/// println!("bytes: {:?}", &buf[..num_bytes_read]);
786786
/// ```
787+
#[doc(alias = "fcntl", alias = "ioctlsocket", alias = "FIONBIO")]
787788
#[stable(feature = "net2_mutators", since = "1.9.0")]
788789
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
789790
self.0.set_nonblocking(nonblocking)

library/std/src/os/wasi/fs.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,51 +173,61 @@ pub trait FileExt {
173173
///
174174
/// This corresponds to the `fd_tell` syscall and is similar to
175175
/// `seek` where you offset 0 bytes from the current position.
176+
#[doc(alias = "fd_tell")]
176177
fn tell(&self) -> io::Result<u64>;
177178

178179
/// Adjust the flags associated with this file.
179180
///
180181
/// This corresponds to the `fd_fdstat_set_flags` syscall.
182+
#[doc(alias = "fd_fdstat_set_flags")]
181183
fn fdstat_set_flags(&self, flags: u16) -> io::Result<()>;
182184

183185
/// Adjust the rights associated with this file.
184186
///
185187
/// This corresponds to the `fd_fdstat_set_rights` syscall.
188+
#[doc(alias = "fd_fdstat_set_rights")]
186189
fn fdstat_set_rights(&self, rights: u64, inheriting: u64) -> io::Result<()>;
187190

188191
/// Provide file advisory information on a file descriptor.
189192
///
190193
/// This corresponds to the `fd_advise` syscall.
194+
#[doc(alias = "fd_advise")]
191195
fn advise(&self, offset: u64, len: u64, advice: u8) -> io::Result<()>;
192196

193197
/// Force the allocation of space in a file.
194198
///
195199
/// This corresponds to the `fd_allocate` syscall.
200+
#[doc(alias = "fd_allocate")]
196201
fn allocate(&self, offset: u64, len: u64) -> io::Result<()>;
197202

198203
/// Create a directory.
199204
///
200205
/// This corresponds to the `path_create_directory` syscall.
206+
#[doc(alias = "path_create_directory")]
201207
fn create_directory<P: AsRef<Path>>(&self, dir: P) -> io::Result<()>;
202208

203209
/// Read the contents of a symbolic link.
204210
///
205211
/// This corresponds to the `path_readlink` syscall.
212+
#[doc(alias = "path_readlink")]
206213
fn read_link<P: AsRef<Path>>(&self, path: P) -> io::Result<PathBuf>;
207214

208215
/// Return the attributes of a file or directory.
209216
///
210217
/// This corresponds to the `path_filestat_get` syscall.
218+
#[doc(alias = "path_filestat_get")]
211219
fn metadata_at<P: AsRef<Path>>(&self, lookup_flags: u32, path: P) -> io::Result<Metadata>;
212220

213221
/// Unlink a file.
214222
///
215223
/// This corresponds to the `path_unlink_file` syscall.
224+
#[doc(alias = "path_unlink_file")]
216225
fn remove_file<P: AsRef<Path>>(&self, path: P) -> io::Result<()>;
217226

218227
/// Remove a directory.
219228
///
220229
/// This corresponds to the `path_remove_directory` syscall.
230+
#[doc(alias = "path_remove_directory")]
221231
fn remove_directory<P: AsRef<Path>>(&self, path: P) -> io::Result<()>;
222232
}
223233

@@ -359,6 +369,7 @@ pub trait OpenOptionsExt {
359369
/// Open a file or directory.
360370
///
361371
/// This corresponds to the `path_open` syscall.
372+
#[doc(alias = "path_open")]
362373
fn open_at<P: AsRef<Path>>(&self, file: &File, path: P) -> io::Result<File>;
363374
}
364375

@@ -500,6 +511,7 @@ impl DirEntryExt for fs::DirEntry {
500511
/// Create a hard link.
501512
///
502513
/// This corresponds to the `path_link` syscall.
514+
#[doc(alias = "path_link")]
503515
pub fn link<P: AsRef<Path>, U: AsRef<Path>>(
504516
old_fd: &File,
505517
old_flags: u32,
@@ -518,6 +530,7 @@ pub fn link<P: AsRef<Path>, U: AsRef<Path>>(
518530
/// Rename a file or directory.
519531
///
520532
/// This corresponds to the `path_rename` syscall.
533+
#[doc(alias = "path_rename")]
521534
pub fn rename<P: AsRef<Path>, U: AsRef<Path>>(
522535
old_fd: &File,
523536
old_path: P,
@@ -534,6 +547,7 @@ pub fn rename<P: AsRef<Path>, U: AsRef<Path>>(
534547
/// Create a symbolic link.
535548
///
536549
/// This corresponds to the `path_symlink` syscall.
550+
#[doc(alias = "path_symlink")]
537551
pub fn symlink<P: AsRef<Path>, U: AsRef<Path>>(
538552
old_path: P,
539553
fd: &File,

library/std/src/os/windows/fs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ impl FileTimesExt for fs::FileTimes {
577577
/// the process as an administrator.
578578
///
579579
/// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links
580+
#[doc(alias = "CreateSymbolicLink", alias = "CreateSymbolicLinkW")]
580581
#[stable(feature = "symlink", since = "1.1.0")]
581582
pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> {
582583
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:
616617
/// the process as an administrator.
617618
///
618619
/// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links
620+
#[doc(alias = "CreateSymbolicLink", alias = "CreateSymbolicLinkW")]
619621
#[stable(feature = "symlink", since = "1.1.0")]
620622
pub fn symlink_dir<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> {
621623
sys::fs::symlink_inner(original.as_ref(), link.as_ref(), true)

library/std/src/time.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ pub use core::time::TryFromFloatSecsError;
150150
/// [`checked_duration_since`]: Instant::checked_duration_since
151151
///
152152
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
153+
#[doc(alias = "insecure_time")]
154+
#[doc(alias = "clock_gettime")]
155+
#[doc(alias = "mach_absolute_time")]
156+
#[doc(alias = "get_tim")]
157+
#[doc(alias = "__wasi_clock_time_get")]
158+
#[doc(alias = "QueryPerformanceCounter")]
153159
#[stable(feature = "time2", since = "1.8.0")]
154160
pub struct Instant(time::Instant);
155161

@@ -235,6 +241,12 @@ pub struct Instant(time::Instant);
235241
///
236242
/// [`add`]: SystemTime::add
237243
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
244+
#[doc(alias = "insecure_time")]
245+
#[doc(alias = "clock_gettime")]
246+
#[doc(alias = "gettimeofday")]
247+
#[doc(alias = "SOLID_RTC_ReadTime")]
248+
#[doc(alias = "__wasi_clock_time_get")]
249+
#[doc(alias = "GetSystemTimePreciseAsFileTime")]
238250
#[stable(feature = "time2", since = "1.8.0")]
239251
pub struct SystemTime(time::SystemTime);
240252

0 commit comments

Comments
 (0)