about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-08-31 08:51:53 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-12-09 07:19:17 -0800
commit0a13f1abafe70cddf34bf2b2ba3946c418ed6241 (patch)
tree83dc0df06aa7029c29aa4655e332e15b5f47929e /src/libstd/thread
parent8864f2c83ac800881da34c3e835c931c081a8785 (diff)
downloadrust-0a13f1abafe70cddf34bf2b2ba3946c418ed6241.tar.gz
rust-0a13f1abafe70cddf34bf2b2ba3946c418ed6241.zip
std: Rename thread::catch_panic to panic::recover
This commit is an implementation of [RFC 1236] and [RFC 1323] which
rename the `thread::catch_panic` function to `panic::recover` while also
replacing the `Send + 'static` bounds with a new `PanicSafe` bound.

[RFC 1236]: https://github.com/rust-lang/rfcs/pull/1236
[RFC 1323]: https://github.com/rust-lang/rfcs/pull/1323

cc #27719
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/mod.rs19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index aef47aa5726..d4f04d5d94f 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -355,26 +355,9 @@ pub fn panicking() -> bool {
 /// with exception safety. Furthermore, a `Send` bound is also required,
 /// providing the same safety guarantees as `thread::spawn` (ensuring the
 /// closure is properly isolated from the parent).
-///
-/// # Examples
-///
-/// ```
-/// #![feature(catch_panic)]
-///
-/// use std::thread;
-///
-/// let result = thread::catch_panic(|| {
-///     println!("hello!");
-/// });
-/// assert!(result.is_ok());
-///
-/// let result = thread::catch_panic(|| {
-///     panic!("oh no!");
-/// });
-/// assert!(result.is_err());
-/// ```
 #[unstable(feature = "catch_panic", reason = "recent API addition",
            issue = "27719")]
+#[rustc_deprecated(since = "1.6.0", reason = "renamed to std::panic::recover")]
 pub fn catch_panic<F, R>(f: F) -> Result<R>
     where F: FnOnce() -> R + Send + 'static
 {