diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2015-08-19 16:03:59 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2015-08-22 13:58:39 +0200 |
| commit | c408b7863389aa2bdb253ffa363e693bcd02439f (patch) | |
| tree | d24554daf2d34ade8df07a7a68c4a5ced316cf0b /src/liballoc/rc.rs | |
| parent | 94ee3b5a54a9f4965b82f5e4eda512966e96ac63 (diff) | |
| download | rust-c408b7863389aa2bdb253ffa363e693bcd02439f.tar.gz rust-c408b7863389aa2bdb253ffa363e693bcd02439f.zip | |
Move the Borrow and BorrowMut traits to libcore.
Diffstat (limited to 'src/liballoc/rc.rs')
| -rw-r--r-- | src/liballoc/rc.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 9649d0f71a1..b1fb5be4d21 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -158,6 +158,7 @@ use boxed::Box; #[cfg(test)] use std::boxed::Box; +use core::borrow; use core::cell::Cell; use core::cmp::Ordering; use core::fmt; @@ -1091,3 +1092,7 @@ mod tests { assert_eq!(foo, foo.clone()); } } + +impl<T: ?Sized> borrow::Borrow<T> for Rc<T> { + fn borrow(&self) -> &T { &**self } +} |
