Skip to content

Commit 58174e3

Browse files
authored
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.
2 parents 6582009 + 08c9732 commit 58174e3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/io/error.rs

+2
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ impl Error {
573573
/// println!("last OS error: {os_error:?}");
574574
/// ```
575575
#[stable(feature = "rust1", since = "1.0.0")]
576+
#[doc(alias = "GetLastError")]
577+
#[doc(alias = "errno")]
576578
#[must_use]
577579
#[inline]
578580
pub fn last_os_error() -> Error {

0 commit comments

Comments
 (0)