Skip to content

Commit

Permalink
std: Stabilize the catch_panic feature
Browse files Browse the repository at this point in the history
This function has remained in std for quite some time now without modifications,
and it's a core building block for robust FFI, so this commit stabilizes the
signature as-is.

It is possible to relax the `Send` or `'static` bounds in the future
additionally.

Closes rust-lang#25662
  • Loading branch information
alexcrichton committed Jun 22, 2015
1 parent 45f830b commit 72787dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/libstd/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ pub fn panicking() -> bool {
/// # Examples
///
/// ```
/// # #![feature(catch_panic)]
/// use std::thread;
///
/// let result = thread::catch_panic(|| {
Expand All @@ -469,7 +468,7 @@ pub fn panicking() -> bool {
/// });
/// assert!(result.is_err());
/// ```
#[unstable(feature = "catch_panic", reason = "recent API addition")]
#[stable(feature = "catch_panic", since = "1.3.0")]
pub fn catch_panic<F, R>(f: F) -> Result<R>
where F: FnOnce() -> R + Send + 'static
{
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/binary-heap-panic-safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(std_misc, collections, catch_panic, rand, sync_poison)]
#![feature(std_misc, collections, rand, sync_poison)]

use std::__rand::{thread_rng, Rng};
use std::thread;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/running-with-no-runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(catch_panic, start)]
#![feature(start)]

use std::ffi::CStr;
use std::process::{Command, Output};
Expand Down

0 comments on commit 72787dd

Please sign in to comment.