about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-09 16:57:46 +0000
committerbors <bors@rust-lang.org>2015-12-09 16:57:46 +0000
commit6bf8cc578985c5236cb90924994816ee7a25ce8a (patch)
tree44b6183070f326753331558f3df71b2730da59a7 /src/libstd/thread
parenteebf6743d88509412308553e7172e89157f9b981 (diff)
parent0a13f1abafe70cddf34bf2b2ba3946c418ed6241 (diff)
downloadrust-6bf8cc578985c5236cb90924994816ee7a25ce8a.tar.gz
rust-6bf8cc578985c5236cb90924994816ee7a25ce8a.zip
Auto merge of #29937 - alexcrichton:panic-recover, r=alexcrichton
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
 {