Skip to content

Commit 286bb18

Browse files
authored
Rollup merge of #92748 - david-perez:eliminate-boxed-wording-std-error, r=Mark-Simulacrum
Eliminate "boxed" wording in `std::error::Error` documentation In commit 29403ee, documentation for the methods on `std::any::Any` was modified so that they referred to the concrete value behind the trait object as the "inner" value. This is a more accurate wording than "boxed": while putting trait objects inside boxes is arguably the most common use, they can also be placed behind other pointer types like `&mut` or `std::sync::Arc`. This commit does the same documentation changes for `std::error::Error`.
2 parents bc0a165 + 5786bbd commit 286bb18

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/std/src/error.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -606,21 +606,21 @@ impl Error for time::FromSecsError {}
606606

607607
// Copied from `any.rs`.
608608
impl dyn Error + 'static {
609-
/// Returns `true` if the boxed type is the same as `T`
609+
/// Returns `true` if the inner type is the same as `T`.
610610
#[stable(feature = "error_downcast", since = "1.3.0")]
611611
#[inline]
612612
pub fn is<T: Error + 'static>(&self) -> bool {
613613
// Get `TypeId` of the type this function is instantiated with.
614614
let t = TypeId::of::<T>();
615615

616-
// Get `TypeId` of the type in the trait object.
617-
let boxed = self.type_id(private::Internal);
616+
// Get `TypeId` of the type in the trait object (`self`).
617+
let concrete = self.type_id(private::Internal);
618618

619619
// Compare both `TypeId`s on equality.
620-
t == boxed
620+
t == concrete
621621
}
622622

623-
/// Returns some reference to the boxed value if it is of type `T`, or
623+
/// Returns some reference to the inner value if it is of type `T`, or
624624
/// `None` if it isn't.
625625
#[stable(feature = "error_downcast", since = "1.3.0")]
626626
#[inline]
@@ -632,7 +632,7 @@ impl dyn Error + 'static {
632632
}
633633
}
634634

635-
/// Returns some mutable reference to the boxed value if it is of type `T`, or
635+
/// Returns some mutable reference to the inner value if it is of type `T`, or
636636
/// `None` if it isn't.
637637
#[stable(feature = "error_downcast", since = "1.3.0")]
638638
#[inline]

0 commit comments

Comments
 (0)