}
}
+#[stable(feature = "u8_from_char", since = "1.59.0")]
+impl Error for char::TryFromCharError {}
+
#[unstable(feature = "map_try_insert", issue = "82766")]
impl<'a, K: Debug + Ord, V: Debug> Error
for crate::collections::btree_map::OccupiedError<'a, K, V>
// Copied from `any.rs`.
impl dyn Error + 'static {
- /// Returns `true` if the boxed type is the same as `T`
+ /// Returns `true` if the inner type is the same as `T`.
#[stable(feature = "error_downcast", since = "1.3.0")]
#[inline]
pub fn is<T: Error + 'static>(&self) -> bool {
// Get `TypeId` of the type this function is instantiated with.
let t = TypeId::of::<T>();
- // Get `TypeId` of the type in the trait object.
- let boxed = self.type_id(private::Internal);
+ // Get `TypeId` of the type in the trait object (`self`).
+ let concrete = self.type_id(private::Internal);
// Compare both `TypeId`s on equality.
- t == boxed
+ t == concrete
}
- /// Returns some reference to the boxed value if it is of type `T`, or
+ /// Returns some reference to the inner value if it is of type `T`, or
/// `None` if it isn't.
#[stable(feature = "error_downcast", since = "1.3.0")]
#[inline]
}
}
- /// Returns some mutable reference to the boxed value if it is of type `T`, or
+ /// Returns some mutable reference to the inner value if it is of type `T`, or
/// `None` if it isn't.
#[stable(feature = "error_downcast", since = "1.3.0")]
#[inline]
for (ind, error) in cause.chain().enumerate() {
writeln!(f)?;
- let mut indented = Indented {
- inner: f,
- };
+ let mut indented = Indented { inner: f };
if multiple {
write!(indented, "{: >4}: {}", ind, error)?;
} else {
}
}
-impl Report<Box<dyn Error>>
-{
+impl Report<Box<dyn Error>> {
fn backtrace(&self) -> Option<&Backtrace> {
// have to grab the backtrace on the first error directly since that error may not be
// 'static
for (ind, error) in cause.chain().enumerate() {
writeln!(f)?;
- let mut indented = Indented {
- inner: f,
- };
+ let mut indented = Indented { inner: f };
if multiple {
write!(indented, "{: >4}: {}", ind, error)?;
} else {
}
#[unstable(feature = "error_reporter", issue = "90172")]
-impl fmt::Display for Report<Box<dyn Error>>
-{
+impl fmt::Display for Report<Box<dyn Error>> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.pretty { self.fmt_multiline(f) } else { self.fmt_singleline(f) }
}