Remove unnecessary bounds on Error and Display implementations for TryLockError and PoisonError.#31589
Conversation
…yLockError and PoisonError.
|
@bors r+ rollup |
|
📌 Commit 8bbb70c has been approved by |
|
Why is the |
|
|
|
Ah |
| match *self { | ||
| TryLockError::Poisoned(..) => "poisoned lock: another task failed inside", | ||
| TryLockError::WouldBlock => "try_lock failed because the operation would block" | ||
| }.fmt(f) |
There was a problem hiding this comment.
How come this can't continue to delegate to the same implementation? It seems unfortunate to have to duplicate this with description above
There was a problem hiding this comment.
Calling into the Error implementation via description would require adding a Reflect bound, which is not really needed here.
There was a problem hiding this comment.
But you can't have an instance of TryLockError<T> where T isn't Reflect, right?
There was a problem hiding this comment.
If you're dealing with a generic TryLockError<T> you would have to include the Reflect bound, which is annoying and impossible on stable, where you'd have to bound by Any, which is unnecessarily restrictive. You could do where TryLockError<T>: Display but this is also annoying if you have already asserted T: Display elsewhere.
EDIT: Actually under this definition you don't need any bounds on T, so that last line is wrong.
…ds, r=sfackler None
…ds, r=sfackler None
No description provided.