-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you can't have an instance of TryLockError<T>
where T
isn't Reflect
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.