|
147 | 147 | use clone::Clone; |
148 | 148 | use cmp::{PartialEq, Eq}; |
149 | 149 | use default::Default; |
150 | | -use marker::{Copy, Send, Sync, Sized}; |
151 | | -use ops::{Deref, DerefMut, Drop, FnOnce}; |
| 150 | +use marker::{Copy, Send, Sync, Sized, Unsize}; |
| 151 | +use ops::{Deref, DerefMut, Drop, FnOnce, CoerceUnsized}; |
152 | 152 | use option::Option; |
153 | 153 | use option::Option::{None, Some}; |
154 | 154 |
|
@@ -638,6 +638,9 @@ impl<'b, T: ?Sized> Ref<'b, T> { |
638 | 638 | } |
639 | 639 | } |
640 | 640 |
|
| 641 | +#[unstable(feature = "coerce_unsized", issue = "27732")] |
| 642 | +impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {} |
| 643 | + |
641 | 644 | impl<'b, T: ?Sized> RefMut<'b, T> { |
642 | 645 | /// Make a new `RefMut` for a component of the borrowed data, e.g. an enum |
643 | 646 | /// variant. |
@@ -770,6 +773,9 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> { |
770 | 773 | } |
771 | 774 | } |
772 | 775 |
|
| 776 | +#[unstable(feature = "coerce_unsized", issue = "27732")] |
| 777 | +impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {} |
| 778 | + |
773 | 779 | /// The core primitive for interior mutability in Rust. |
774 | 780 | /// |
775 | 781 | /// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the |
|
0 commit comments