Skip to content

Commit e9d7041

Browse files
committed
std: use more portable error number in from_raw_os_error docs
On MIPS, error number 98 is not EADDRINUSE (it is EPROTOTYPE). To fix the resulting test failure this causes, use a more portable error number in the example documentation. EINVAL shold be more reliable because it was defined in the original Unix as 22 so hopefully most derivatives have defined it the same way.
1 parent fe7e1a4 commit e9d7041

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/io/error.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ impl Error {
292292
/// # if cfg!(target_os = "linux") {
293293
/// use std::io;
294294
///
295-
/// let error = io::Error::from_raw_os_error(98);
296-
/// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
295+
/// let error = io::Error::from_raw_os_error(22);
296+
/// assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
297297
/// # }
298298
/// ```
299299
///
@@ -303,8 +303,8 @@ impl Error {
303303
/// # if cfg!(windows) {
304304
/// use std::io;
305305
///
306-
/// let error = io::Error::from_raw_os_error(10048);
307-
/// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
306+
/// let error = io::Error::from_raw_os_error(10022);
307+
/// assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
308308
/// # }
309309
/// ```
310310
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)