Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate "boxed" wording in std::error::Error documentation #92748

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions library/std/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down