-
Notifications
You must be signed in to change notification settings - Fork 5
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
Also compare panicking behavior #4
Conversation
@Shnatsel, I'm sorry for not getting back to you about this PR. |
After merging the latest master I'm getting a different error:
I feel a strategically placed |
Reduced testcase showing the same error by @Soveu : |
@Shnatsel, well, adding I can take a look. 🙂 |
I think we can get rid of the clones if one closure is nested inside the other, something like let model_panic_res = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
model.#method_name(#(#args),*)
let tested_panic_res = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
tested.#method_name(#(#args),*)
// TODO: comparison code here while both references are still alive
}));
})); |
You can pass a mutable reference through a fn main() {
use std::panic;
let mut v = vec![64u64; 64];
let v = panic::AssertUnwindSafe(&mut v);
let x = panic::catch_unwind(move || {
v.0.get_mut(999)
});
println!("{:?}", x);
} I couldn't explain why, but it seems like Rust won't treat the closure as an |
I've attempted to implement #2 but ended up in a weird lifetime hell, and could not resolve it by myself. I'm opening a WIP PR so that someone else might get a better starting point if they try to implement this.
The error is: