diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2016-08-06 13:48:59 -0400 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2016-08-08 23:59:56 -0400 |
| commit | a20a1db54ad869fc3ed810badd6b2f5634e20276 (patch) | |
| tree | 7e10b4d7473773a93ef66becb979ed75c5b35cd3 /src/libstd | |
| parent | ecdd51b7bb7fd993acd2ff5dbd72209244b1e4aa (diff) | |
| download | rust-a20a1db54ad869fc3ed810badd6b2f5634e20276.tar.gz rust-a20a1db54ad869fc3ed810badd6b2f5634e20276.zip | |
Implement `RefCell::{try_borrow, try_borrow_mut}`
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/error.rs | 15 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 1 |
2 files changed, 16 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` diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 865d067cdb6..c6272012d66 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -269,6 +269,7 @@ #![feature(str_utf16)] #![feature(test, rustc_private)] #![feature(thread_local)] +#![feature(try_borrow)] #![feature(try_from)] #![feature(unboxed_closures)] #![feature(unicode)] |
