]> git.lizzy.rs Git - rust.git/commitdiff
std: use more portable error number in from_raw_os_error docs
authorJames Cowgill <jcowgill@debian.org>
Tue, 23 Jan 2018 14:47:30 +0000 (14:47 +0000)
committerJames Cowgill <jcowgill@debian.org>
Tue, 30 Jan 2018 11:53:50 +0000 (11:53 +0000)
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.

src/libstd/io/error.rs

index f0b41f30251e09d10209422ea9cd23eb139588ad..bdd675e6e2b851d8f581190902a913ac140ce26b 100644 (file)
@@ -292,8 +292,8 @@ pub fn last_os_error() -> Error {
     /// # if cfg!(target_os = "linux") {
     /// use std::io;
     ///
-    /// let error = io::Error::from_raw_os_error(98);
-    /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
+    /// let error = io::Error::from_raw_os_error(22);
+    /// assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
     /// # }
     /// ```
     ///
@@ -303,8 +303,8 @@ pub fn last_os_error() -> Error {
     /// # if cfg!(windows) {
     /// use std::io;
     ///
-    /// let error = io::Error::from_raw_os_error(10048);
-    /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse);
+    /// let error = io::Error::from_raw_os_error(10022);
+    /// assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
     /// # }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]