Skip to content

Commit 84e729a

Browse files
committed
Auto merge of #123851 - NobodyXu:patch-1, r=BurntSushi
Update document for std::io::Error::downcast Resolve concern raised by `@BurntSushi` #99262 (comment)
2 parents d493fd1 + 05366ee commit 84e729a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

library/std/src/io/error.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -852,15 +852,19 @@ impl Error {
852852
}
853853
}
854854

855-
/// Attempt to downcast the inner error to `E` if any.
855+
/// Attempt to downcast the custom boxed error to `E`.
856856
///
857-
/// If this [`Error`] was constructed via [`new`] then this function will
858-
/// attempt to perform downgrade on it, otherwise it will return [`Err`].
857+
/// If this [`Error`] contains a custom boxed error,
858+
/// then it would attempt downcasting on the boxed error,
859+
/// otherwise it will return [`Err`].
859860
///
860-
/// If the downcast succeeds, it will return [`Ok`], otherwise it will also
861-
/// return [`Err`].
861+
/// If the custom boxed error has the same type as `E`, it will return [`Ok`],
862+
/// otherwise it will also return [`Err`].
863+
///
864+
/// This method is meant to be a convenience routine for calling
865+
/// `Box<dyn Error + Sync + Send>::downcast` on the custom boxed error, returned by
866+
/// [`Error::into_inner`].
862867
///
863-
/// [`new`]: Error::new
864868
///
865869
/// # Examples
866870
///

0 commit comments

Comments
 (0)