Skip to content

Commit

Permalink
Update panic::recover usage
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed May 10, 2016
1 parent 5398094 commit 166e453
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
#![allow(trivial_numeric_casts, trivial_casts)]
#![deny(missing_docs)]
#![cfg_attr(test, deny(warnings))]
#![cfg_attr(feature = "unstable", feature(recover, std_panic))]

extern crate libc;
extern crate url;
Expand Down
4 changes: 2 additions & 2 deletions src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ thread_local!(static LAST_ERROR: RefCell<Option<Box<Any + Send>>> = {
});

#[cfg(feature = "unstable")]
pub fn wrap<T, F: FnOnce() -> T + ::std::panic::RecoverSafe>(f: F) -> Option<T> {
pub fn wrap<T, F: FnOnce() -> T + ::std::panic::UnwindSafe>(f: F) -> Option<T> {
use std::panic;
if LAST_ERROR.with(|slot| slot.borrow().is_some()) {
return None
}
match panic::recover(f) {
match panic::catch_unwind(f) {
Ok(ret) => Some(ret),
Err(e) => {
LAST_ERROR.with(move |slot| {
Expand Down

0 comments on commit 166e453

Please sign in to comment.