about summary refs log tree commit diff
path: root/src/libstd/error.rs
diff options
context:
space:
mode:
authorAndrew Paseltiner <apaseltiner@gmail.com>2016-08-06 13:48:59 -0400
committerAndrew Paseltiner <apaseltiner@gmail.com>2016-08-08 23:59:56 -0400
commita20a1db54ad869fc3ed810badd6b2f5634e20276 (patch)
tree7e10b4d7473773a93ef66becb979ed75c5b35cd3 /src/libstd/error.rs
parentecdd51b7bb7fd993acd2ff5dbd72209244b1e4aa (diff)
downloadrust-a20a1db54ad869fc3ed810badd6b2f5634e20276.tar.gz
rust-a20a1db54ad869fc3ed810badd6b2f5634e20276.zip
Implement `RefCell::{try_borrow, try_borrow_mut}`
Diffstat (limited to 'src/libstd/error.rs')
-rw-r--r--src/libstd/error.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 1459420cdc0..914599271ac 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -49,6 +49,7 @@
 
 use any::TypeId;
 use boxed::Box;
+use cell;
 use char;
 use fmt::{self, Debug, Display};
 use marker::{Send, Sync, Reflect};
@@ -289,6 +290,20 @@ impl Error for fmt::Error {
     }
 }
 
+#[unstable(feature = "try_borrow", issue = "35070")]
+impl<'a, T: ?Sized + Reflect> Error for cell::BorrowError<'a, T> {
+    fn description(&self) -> &str {
+        "already mutably borrowed"
+    }
+}
+
+#[unstable(feature = "try_borrow", issue = "35070")]
+impl<'a, T: ?Sized + Reflect> Error for cell::BorrowMutError<'a, T> {
+    fn description(&self) -> &str {
+        "already borrowed"
+    }
+}
+
 // copied from any.rs
 impl Error + 'static {
     /// Returns true if the boxed type is the same as `T`