about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-12 07:12:15 +0100
committerGitHub <noreply@github.com>2022-01-12 07:12:15 +0100
commit286bb18a9b8c8bafe64eb9add96f597a3d80f832 (patch)
tree94085cef2429674da61185207ff63ff24d422fd1
parentbc0a16524097d6c0f2d867c60d68cced19efb1db (diff)
parent5786bbddc670597af286381b27fbb9f563cf7dc7 (diff)
downloadrust-286bb18a9b8c8bafe64eb9add96f597a3d80f832.tar.gz
rust-286bb18a9b8c8bafe64eb9add96f597a3d80f832.zip
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`.
-rw-r--r--library/std/src/error.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/std/src/error.rs b/library/std/src/error.rs
index ea0c230fa42..526a1b92b19 100644
--- a/library/std/src/error.rs
+++ b/library/std/src/error.rs
@@ -606,21 +606,21 @@ impl Error for time::FromSecsError {}
 
 // 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]
@@ -632,7 +632,7 @@ impl dyn Error + 'static {
         }
     }
 
-    /// 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]