about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-15 12:32:57 +0000
committerbors <bors@rust-lang.org>2024-04-15 12:32:57 +0000
commit84e729a59f216cc64755788a470f165429a731f4 (patch)
tree0a69960b05a41a6f70835f20997c1f87321b936e /library/std/src
parentd493fd148d3033904cd5769dcd8b35b9f2504925 (diff)
parent05366ee2707b1f594edf06de3b0e7edb16f0aa94 (diff)
downloadrust-84e729a59f216cc64755788a470f165429a731f4.tar.gz
rust-84e729a59f216cc64755788a470f165429a731f4.zip
Auto merge of #123851 - NobodyXu:patch-1, r=BurntSushi
Update document for std::io::Error::downcast

Resolve concern raised by `@BurntSushi` https://github.com/rust-lang/rust/issues/99262#issuecomment-2042641813
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/io/error.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs
index 4e1d7c2ac65..21ae7b91207 100644
--- a/library/std/src/io/error.rs
+++ b/library/std/src/io/error.rs
@@ -852,15 +852,19 @@ impl Error {
         }
     }
 
-    /// Attempt to downcast the inner error to `E` if any.
+    /// Attempt to downcast the custom boxed error to `E`.
     ///
-    /// If this [`Error`] was constructed via [`new`] then this function will
-    /// attempt to perform downgrade on it, otherwise it will return [`Err`].
+    /// If this [`Error`] contains a custom boxed error,
+    /// then it would attempt downcasting on the boxed error,
+    /// otherwise it will return [`Err`].
     ///
-    /// If the downcast succeeds, it will return [`Ok`], otherwise it will also
-    /// return [`Err`].
+    /// If the custom boxed error has the same type as `E`, it will return [`Ok`],
+    /// otherwise it will also return [`Err`].
+    ///
+    /// This method is meant to be a convenience routine for calling
+    /// `Box<dyn Error + Sync + Send>::downcast` on the custom boxed error, returned by
+    /// [`Error::into_inner`].
     ///
-    /// [`new`]: Error::new
     ///
     /// # Examples
     ///