-
Notifications
You must be signed in to change notification settings - Fork 69
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
Reduce mutex poisoning #515
Labels
enhancement
New feature or request
Comments
asomers
added a commit
that referenced
this issue
Dec 9, 2023
If a test case panics while holding a static method's internal Mutex locked, for example by violating a times() constraint, then clear the Mutex's poison during Drop. We're going to delete all of its Expectations anyway, so there's no data to be poisoned. Requires nightly. Fixes #515
Merged
asomers
added a commit
that referenced
this issue
Dec 9, 2023
If a test case panics while holding a static method's internal Mutex locked, for example by violating a times() constraint, then clear the Mutex's poison during Drop. We're going to delete all of its Expectations anyway, so there's no data to be poisoned. Requires nightly. Fixes #515
asomers
added a commit
that referenced
this issue
Jan 14, 2024
If a test case panics while holding a static method's internal Mutex locked, for example by violating a times() constraint, then clear the Mutex's poison during Drop. We're going to delete all of its Expectations anyway, so there's no data to be poisoned. Requires nightly. Fixes #515
asomers
added a commit
that referenced
this issue
Feb 24, 2024
If a test case panics while holding a static method's internal Mutex locked, for example by violating a times() constraint, then clear the Mutex's poison during Drop. We're going to delete all of its Expectations anyway, so there's no data to be poisoned. Requires nightly. Fixes #515
asomers
added a commit
that referenced
this issue
Feb 24, 2024
If a test case panics while holding a static method's internal Mutex locked, for example by violating a times() constraint, then clear the Mutex's poison during Drop. We're going to delete all of its Expectations anyway, so there's no data to be poisoned. Requires nightly. Fixes #515
asomers
added a commit
that referenced
this issue
Feb 24, 2024
If a test case panics while holding a static method's internal Mutex locked, for example by violating a times() constraint, then clear the Mutex's poison during Drop. We're going to delete all of its Expectations anyway, so there's no data to be poisoned. Requires nightly. Fixes #515
asomers
added a commit
that referenced
this issue
Feb 24, 2024
If a test case panics while holding a static method's internal Mutex locked, for example by violating a times() constraint, then clear the Mutex's poison during Drop. We're going to delete all of its Expectations anyway, so there's no data to be poisoned. Requires nightly. Fixes #515
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mocked static methods contain an internal Mutex . If a test case panics while accessing it (for example, by violating a
.times()
constraint, or by explicitly panicing in the.returning
function), then the Mutex will be poisoned, and all future test cases trying to use the same static method will fail withPoisonError
.mockall/mockall_derive/src/mock_function.rs
Line 1400 in cab6091
mockall/mockall_derive/src/mock_function.rs
Line 1469 in cab6091
But the
Expectations
object guarded by this Mutex gets cleared on Drop anyway. So we may as well clear any poison at the same time. That requires a nightly compiler.https://doc.rust-lang.org/std/sync/struct.Mutex.html#method.clear_poison
The text was updated successfully, but these errors were encountered: