Allow any closure to be used with catch_panic

Asserting unwind safe is supposed to mean that we poison mutable object
involved in the panic (to prevent objects that were involved in panics
from triggering errors over and over again) and we should do that in the
future.
This commit is contained in:
Yehuda Katz 2017-05-15 16:22:48 -07:00 committed by Godfrey Chan
parent 41172104ab
commit 27d4a7458b
1 changed files with 4 additions and 2 deletions

View File

@ -331,9 +331,11 @@ macro_rules! handle_exception {
}));
}
let res = ::std::panic::catch_unwind(|| {
// TODO: Poison any objects that cross the boundary to prevent them
// from being used in Ruby and triggering panics over and over again.
let res = ::std::panic::catch_unwind(::std::panic::AssertUnwindSafe(|| {
$($body)*
});
}));
if hide_err {
let _ = ::std::panic::take_hook();