about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-28 09:35:14 +0200
committerGitHub <noreply@github.com>2022-08-28 09:35:14 +0200
commit58174e3f7cdbab1fedcd268465a01b891e9e62e2 (patch)
treed290ad155e886d9cdbdd0c0363036d1901357cd0
parent65820098b959a158e910a2992fb0784927c31bc1 (diff)
parent08c97323dee8b8558c8e1dc770885f0095360d32 (diff)
downloadrust-58174e3f7cdbab1fedcd268465a01b891e9e62e2.tar.gz
rust-58174e3f7cdbab1fedcd268465a01b891e9e62e2.zip
Rollup merge of #100296 - BlackHoleFox:os-error-aliases, r=thomcc
Add standard C error function aliases to last_os_error

This aids the discoverability of `io::Error::last_os_error()` by linking to commonly used error number functions from C/C++.

I've seen a few people not realize this exists, so hopefully this helps draw attention to the API to encourage using it over integer error codes.
-rw-r--r--library/std/src/io/error.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs
index 885e44f5e18..29b09fcc527 100644
--- a/library/std/src/io/error.rs
+++ b/library/std/src/io/error.rs
@@ -573,6 +573,8 @@ impl Error {
     /// println!("last OS error: {os_error:?}");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[doc(alias = "GetLastError")]
+    #[doc(alias = "errno")]
     #[must_use]
     #[inline]
     pub fn last_os_error() -> Error {