diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-02 12:16:41 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-02 13:51:50 -0800 |
| commit | 340f3fd7a909b30509a63916df06f2b885d113f7 (patch) | |
| tree | 344f3d621e187b41d23ef01f621ff68ebe810a03 /src/liballoc | |
| parent | 8cf9929a9a901b68d4624167542924e8b181e96a (diff) | |
| parent | 1abee08cbdbd62a83805aa5b5068df9e00471f06 (diff) | |
| download | rust-340f3fd7a909b30509a63916df06f2b885d113f7.tar.gz rust-340f3fd7a909b30509a63916df06f2b885d113f7.zip | |
rollup merge of #20410: japaric/assoc-types
Conflicts: src/liballoc/lib.rs src/libcollections/lib.rs src/libcollections/slice.rs src/libcore/ops.rs src/libcore/prelude.rs src/libcore/ptr.rs src/librustc/middle/traits/project.rs src/libstd/c_str.rs src/libstd/io/mem.rs src/libstd/io/mod.rs src/libstd/lib.rs src/libstd/path/posix.rs src/libstd/path/windows.rs src/libstd/prelude.rs src/libstd/rt/exclusive.rs src/libsyntax/lib.rs src/test/compile-fail/issue-18566.rs src/test/run-pass/deref-mut-on-ref.rs src/test/run-pass/deref-on-ref.rs src/test/run-pass/dst-deref-mut.rs src/test/run-pass/dst-deref.rs src/test/run-pass/fixup-deref-mut.rs src/test/run-pass/issue-13264.rs src/test/run-pass/overloaded-autoderef-indexing.rs
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/boxed.rs | 8 | ||||
| -rw-r--r-- | src/liballoc/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 4 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index aa5a7586118..59106aa9777 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -247,7 +247,9 @@ impl<T> BorrowFrom<Arc<T>> for T { } #[experimental = "Deref is experimental."] -impl<T> Deref<T> for Arc<T> { +impl<T> Deref for Arc<T> { + type Target = T; + #[inline] fn deref(&self) -> &T { &self.inner().data diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 5f8789bf1c7..e836b08459b 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -155,11 +155,13 @@ impl fmt::Show for Box<Any> { } } -impl<Sized? T> Deref<T> for Box<T> { +impl<Sized? T> Deref for Box<T> { + type Target = T; + fn deref(&self) -> &T { &**self } } -impl<Sized? T> DerefMut<T> for Box<T> { +impl<Sized? T> DerefMut for Box<T> { fn deref_mut(&mut self) -> &mut T { &mut **self } } @@ -212,7 +214,7 @@ mod test { #[test] fn deref() { - fn homura<T: Deref<i32>>(_: T) { } + fn homura<T: Deref<Target=i32>>(_: T) { } homura(box 765i32); } } diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index d17a54ce6e5..aab513ddeb7 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -66,6 +66,7 @@ #![no_std] #![allow(unknown_features)] #![feature(lang_items, phase, unsafe_destructor, default_type_params, old_orphan_check)] +#![feature(associated_types)] #[phase(plugin, link)] extern crate core; diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index bd250938836..c57231fc434 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -355,7 +355,9 @@ impl<T> BorrowFrom<Rc<T>> for T { } #[experimental = "Deref is experimental."] -impl<T> Deref<T> for Rc<T> { +impl<T> Deref for Rc<T> { + type Target = T; + #[inline(always)] fn deref(&self) -> &T { &self.inner().value |
