Skip to content

Commit 8bbb70c

Browse files
committed
Remove unnecessary bounds on Error and Display implementations for TryLockError and PoisonError.
1 parent 98ec51a commit 8bbb70c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/libstd/sys/common/poison.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<T> fmt::Display for PoisonError<T> {
111111
}
112112

113113
#[stable(feature = "rust1", since = "1.0.0")]
114-
impl<T: Send + Reflect> Error for PoisonError<T> {
114+
impl<T: Reflect> Error for PoisonError<T> {
115115
fn description(&self) -> &str {
116116
"poisoned lock: another task failed inside"
117117
}
@@ -158,14 +158,17 @@ impl<T> fmt::Debug for TryLockError<T> {
158158
}
159159

160160
#[stable(feature = "rust1", since = "1.0.0")]
161-
impl<T: Send + Reflect> fmt::Display for TryLockError<T> {
161+
impl<T> fmt::Display for TryLockError<T> {
162162
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
163-
self.description().fmt(f)
163+
match *self {
164+
TryLockError::Poisoned(..) => "poisoned lock: another task failed inside",
165+
TryLockError::WouldBlock => "try_lock failed because the operation would block"
166+
}.fmt(f)
164167
}
165168
}
166169

167170
#[stable(feature = "rust1", since = "1.0.0")]
168-
impl<T: Send + Reflect> Error for TryLockError<T> {
171+
impl<T: Reflect> Error for TryLockError<T> {
169172
fn description(&self) -> &str {
170173
match *self {
171174
TryLockError::Poisoned(ref p) => p.description(),

0 commit comments

Comments
 (0)