From b94ea8598ca5e70309df51a02d85b282ed8fe020 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 13 Apr 2016 19:30:08 -0700 Subject: [PATCH] Update for nightly changes --- openssl/src/lib.rs | 2 +- openssl/src/ssl/bio.rs | 12 ++++++------ openssl/src/ssl/mod.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openssl/src/lib.rs b/openssl/src/lib.rs index 1942f9cd..154b8fde 100644 --- a/openssl/src/lib.rs +++ b/openssl/src/lib.rs @@ -1,5 +1,5 @@ #![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.9")] -#![cfg_attr(feature = "nightly", feature(const_fn, recover, panic_propagate))] +#![cfg_attr(feature = "nightly", feature(const_fn))] #[macro_use] extern crate bitflags; diff --git a/openssl/src/ssl/bio.rs b/openssl/src/ssl/bio.rs index 4adbfbe2..e53545d7 100644 --- a/openssl/src/ssl/bio.rs +++ b/openssl/src/ssl/bio.rs @@ -82,12 +82,12 @@ unsafe fn state<'a, S: 'a>(bio: *mut BIO) -> &'a mut StreamState { } #[cfg(feature = "nightly")] -fn recover(f: F) -> Result> where F: FnOnce() -> T { - ::std::panic::recover(::std::panic::AssertRecoverSafe(f)) +fn catch_unwind(f: F) -> Result> where F: FnOnce() -> T { + ::std::panic::catch_unwind(::std::panic::AssertUnwindSafe(f)) } #[cfg(not(feature = "nightly"))] -fn recover(f: F) -> Result> where F: FnOnce() -> T { +fn catch_unwind(f: F) -> Result> where F: FnOnce() -> T { Ok(f()) } @@ -97,7 +97,7 @@ unsafe extern "C" fn bwrite(bio: *mut BIO, buf: *const c_char, len: c_ let state = state::(bio); let buf = slice::from_raw_parts(buf as *const _, len as usize); - match recover(|| state.stream.write(buf)) { + match catch_unwind(|| state.stream.write(buf)) { Ok(Ok(len)) => len as c_int, Ok(Err(err)) => { if retriable_error(&err) { @@ -119,7 +119,7 @@ unsafe extern "C" fn bread(bio: *mut BIO, buf: *mut c_char, len: c_int) let state = state::(bio); let buf = slice::from_raw_parts_mut(buf as *mut _, len as usize); - match recover(|| state.stream.read(buf)) { + match catch_unwind(|| state.stream.read(buf)) { Ok(Ok(len)) => len as c_int, Ok(Err(err)) => { if retriable_error(&err) { @@ -154,7 +154,7 @@ unsafe extern "C" fn ctrl(bio: *mut BIO, if cmd == BIO_CTRL_FLUSH { let state = state::(bio); - match recover(|| state.stream.flush()) { + match catch_unwind(|| state.stream.flush()) { Ok(Ok(())) => 1, Ok(Err(err)) => { state.error = Some(err); diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 71a6ccda..e21cc3dd 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -1323,7 +1323,7 @@ impl SslStream { #[cfg(feature = "nightly")] fn check_panic(&mut self) { if let Some(err) = unsafe { bio::take_panic::(self.ssl.get_raw_rbio()) } { - ::std::panic::propagate(err) + ::std::panic::resume_unwind(err) } }