summaryrefslogtreecommitdiffstats
path: root/library/std/src/io/error.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
commit631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch)
treea1b87c8f8cad01cf18f7c5f57a08f102771ed303 /library/std/src/io/error.rs
parentAdding debian version 1.69.0+dfsg1-1. (diff)
downloadrustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz
rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/std/src/io/error.rs')
-rw-r--r--library/std/src/io/error.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs
index 7f07e4fdd..34c0ce9dc 100644
--- a/library/std/src/io/error.rs
+++ b/library/std/src/io/error.rs
@@ -11,7 +11,6 @@ mod repr_unpacked;
#[cfg(not(target_pointer_width = "64"))]
use repr_unpacked::Repr;
-use crate::convert::From;
use crate::error;
use crate::fmt;
use crate::result;
@@ -370,7 +369,7 @@ pub enum ErrorKind {
// "Unusual" error kinds which do not correspond simply to (sets
// of) OS error codes, should be added just above this comment.
- // `Other` and `Uncategorised` should remain at the end:
+ // `Other` and `Uncategorized` should remain at the end:
//
/// A custom error that does not fall under any other I/O error kind.
///
@@ -882,6 +881,13 @@ impl Error {
/// Returns the corresponding [`ErrorKind`] for this error.
///
+ /// This may be a value set by Rust code constructing custom `io::Error`s,
+ /// or if this `io::Error` was sourced from the operating system,
+ /// it will be a value inferred from the system's error encoding.
+ /// See [`last_os_error`] for more details.
+ ///
+ /// [`last_os_error`]: Error::last_os_error
+ ///
/// # Examples
///
/// ```
@@ -892,7 +898,8 @@ impl Error {
/// }
///
/// fn main() {
- /// // Will print "Uncategorized".
+ /// // As no error has (visibly) occurred, this may print anything!
+ /// // It likely prints a placeholder for unidentified (non-)errors.
/// print_error(Error::last_os_error());
/// // Will print "AddrInUse".
/// print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));