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.
This commit is contained in:
Matthias Krüger 2022-08-28 09:35:14 +02:00 committed by GitHub
commit 58174e3f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {