@@ -299,12 +299,16 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
299
299
// into a type to be destructed. If we want to end up with a Box pointer,
300
300
// then mk_ty should make a Box pointer (T -> Box<T>), if we want a
301
301
// borrowed reference then it should be T -> &T.
302
- // FIXME(#19596) unbox `mk_ty`
303
- fn unsized_info < ' blk , ' tcx > ( bcx : Block < ' blk , ' tcx > ,
304
- kind : & ty:: UnsizeKind < ' tcx > ,
305
- id : ast:: NodeId ,
306
- unadjusted_ty : Ty < ' tcx > ,
307
- mk_ty: |Ty < ' tcx > | -> Ty < ' tcx > ) -> ValueRef {
302
+ fn unsized_info < ' blk , ' tcx , F > ( bcx : Block < ' blk , ' tcx > ,
303
+ kind : & ty:: UnsizeKind < ' tcx > ,
304
+ id : ast:: NodeId ,
305
+ unadjusted_ty : Ty < ' tcx > ,
306
+ mk_ty : F ) -> ValueRef where
307
+ F : FnOnce ( Ty < ' tcx > ) -> Ty < ' tcx > ,
308
+ {
309
+ // FIXME(#19596) workaround: `|t| t` causes monomorphization recursion
310
+ fn identity < T > ( t : T ) -> T { t }
311
+
308
312
debug ! ( "unsized_info(kind={}, id={}, unadjusted_ty={})" ,
309
313
kind, id, unadjusted_ty. repr( bcx. tcx( ) ) ) ;
310
314
match kind {
@@ -314,7 +318,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
314
318
let ty_substs = substs. types . get_slice ( subst:: TypeSpace ) ;
315
319
// The dtor for a field treats it like a value, so mk_ty
316
320
// should just be the identity function.
317
- unsized_info( bcx, k, id, ty_substs[ tp_index] , |t| t )
321
+ unsized_info ( bcx, k, id, ty_substs[ tp_index] , identity )
318
322
}
319
323
_ => bcx. sess ( ) . bug ( format ! ( "UnsizeStruct with bad sty: {}" ,
320
324
bcx. ty_to_string( unadjusted_ty) ) [ ] )
0 commit comments