about summary refs log tree commit diff
path: root/src/libstd/panic.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2016-03-17 22:43:17 -0700
committerSteven Fackler <sfackler@gmail.com>2016-03-17 23:37:20 -0700
commit74d00bde8ee55c26683bd788df439a9c29b7042e (patch)
tree76017d2cd7982c826170e455805215b3afc7042e /src/libstd/panic.rs
parentb12b4e4e3266644d519647afc2943cefa2026e07 (diff)
downloadrust-74d00bde8ee55c26683bd788df439a9c29b7042e.tar.gz
rust-74d00bde8ee55c26683bd788df439a9c29b7042e.zip
Make AssertRecoverSafe's field public
It's basically the very definition of a newtype, so we might as well
make things easy on people and let them construct and access it
directly.
Diffstat (limited to 'src/libstd/panic.rs')
-rw-r--r--src/libstd/panic.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs
index 5c2e36623cb..c29a57b096c 100644
--- a/src/libstd/panic.rs
+++ b/src/libstd/panic.rs
@@ -147,7 +147,7 @@ pub trait RefRecoverSafe {}
 /// // });
 ///
 /// // This, however, will compile due to the `AssertRecoverSafe` wrapper
-/// let result = panic::recover(AssertRecoverSafe::new(|| {
+/// let result = panic::recover(AssertRecoverSafe(|| {
 ///     variable += 3;
 /// }));
 /// // ...
@@ -171,7 +171,7 @@ pub trait RefRecoverSafe {}
 /// let other_capture = 3;
 ///
 /// let result = {
-///     let mut wrapper = AssertRecoverSafe::new(&mut variable);
+///     let mut wrapper = AssertRecoverSafe(&mut variable);
 ///     panic::recover(move || {
 ///         **wrapper += other_capture;
 ///     })
@@ -179,7 +179,7 @@ pub trait RefRecoverSafe {}
 /// // ...
 /// ```
 #[unstable(feature = "recover", reason = "awaiting feedback", issue = "27719")]
-pub struct AssertRecoverSafe<T>(T);
+pub struct AssertRecoverSafe<T>(pub T);
 
 // Implementations of the `RecoverSafe` trait:
 //
@@ -216,12 +216,14 @@ impl<T> RefRecoverSafe for AssertRecoverSafe<T> {}
 impl<T> AssertRecoverSafe<T> {
     /// Creates a new `AssertRecoverSafe` wrapper around the provided type.
     #[unstable(feature = "recover", reason = "awaiting feedback", issue = "27719")]
+    #[rustc_deprecated(reason = "the type's field is now public, construct it directly")]
     pub fn new(t: T) -> AssertRecoverSafe<T> {
         AssertRecoverSafe(t)
     }
 
     /// Consumes the `AssertRecoverSafe`, returning the wrapped value.
     #[unstable(feature = "recover", reason = "awaiting feedback", issue = "27719")]
+    #[rustc_deprecated(reason = "the type's field is now public, access it directly")]
     pub fn into_inner(self) -> T {
         self.0
     }