|
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 |
|
@@ -634,6 +634,9 @@ impl<'b, T: ?Sized> Ref<'b, T> {
|
634 | 634 | }
|
635 | 635 | }
|
636 | 636 |
|
| 637 | +#[unstable(feature = "coerce_unsized", issue = "27732")] |
| 638 | +impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {} |
| 639 | + |
637 | 640 | impl<'b, T: ?Sized> RefMut<'b, T> {
|
638 | 641 | /// Make a new `RefMut` for a component of the borrowed data, e.g. an enum
|
639 | 642 | /// variant.
|
@@ -766,6 +769,9 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
|
766 | 769 | }
|
767 | 770 | }
|
768 | 771 |
|
| 772 | +#[unstable(feature = "coerce_unsized", issue = "27732")] |
| 773 | +impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {} |
| 774 | + |
769 | 775 | /// The core primitive for interior mutability in Rust.
|
770 | 776 | ///
|
771 | 777 | /// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the
|
|
0 commit comments