This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Auto traits with closures #29
Closed
Description
One way to use AssertUnwindSafe is to do something like test/mir_calls_to_shim.
fn assert_panics<F>(f: F) where F: FnOnce() {
let f = panic::AssertUnwindSafe(f);
let result = panic::catch_unwind(move || {
f.0()
});
if let Ok(..) = result {
panic!("diverging function returned");
}
}
This would not work once capture_disjoint_fields
is enabled since f.0
is captured, essentially rendering the wrapper redundant.