|
70 | 70 | use marker::Sized; |
71 | 71 | use fmt; |
72 | 72 |
|
| 73 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 74 | +use marker::Unsize; |
| 75 | + |
73 | 76 | /// The `Drop` trait is used to run some code when a value goes out of scope. This |
74 | 77 | /// is sometimes called a 'destructor'. |
75 | 78 | /// |
@@ -1207,3 +1210,34 @@ mod impls { |
1207 | 1210 | } |
1208 | 1211 | } |
1209 | 1212 | } |
| 1213 | + |
| 1214 | +/// Trait that indicates that this is a pointer or a wrapper for one, |
| 1215 | +/// where unsizing can be performed on the pointee. |
| 1216 | +#[unstable(feature = "core")] |
| 1217 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1218 | +#[lang="coerce_unsized"] |
| 1219 | +pub trait CoerceUnsized<T> { |
| 1220 | + // Empty. |
| 1221 | +} |
| 1222 | + |
| 1223 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1224 | +impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {} |
| 1225 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1226 | +impl<'a, 'b: 'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b mut T {} |
| 1227 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1228 | +impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for &'a mut T {} |
| 1229 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1230 | +impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a mut T {} |
| 1231 | + |
| 1232 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1233 | +impl<'a, 'b: 'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} |
| 1234 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1235 | +impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a T {} |
| 1236 | + |
| 1237 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1238 | +impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {} |
| 1239 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1240 | +impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {} |
| 1241 | + |
| 1242 | +#[cfg(not(stage0))] // SNAP c64d671 |
| 1243 | +impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {} |
0 commit comments