}
mir::Rvalue::Cast(mir::CastKind::Unsize, ref source, cast_ty) => {
+ let cast_ty = bcx.monomorphize(&cast_ty);
+
if common::type_is_fat_ptr(bcx.tcx(), cast_ty) {
// into-coerce of a thin pointer to a fat pointer - just
// use the operand path.
p
}
+#[rustc_mir]
+fn coerce_ptr_wrapper_poly<'a, T, Trait: ?Sized>(p: PtrWrapper<'a, T>)
+ -> PtrWrapper<'a, Trait>
+ where PtrWrapper<'a, T>: CoerceUnsized<PtrWrapper<'a, Trait>>
+{
+ p
+}
fn main() {
let a = [0,1,2];
let z = coerce_fat_ptr_wrapper(PtrWrapper(2,3,(),&square_local));
assert_eq!((z.3)(6), 36);
+
+ let z: PtrWrapper<Fn(u32) -> u32> =
+ coerce_ptr_wrapper_poly(PtrWrapper(2,3,(),&square_local));
+ assert_eq!((z.3)(6), 36);
}