Skip to content

Commit fd9f0d8

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 167723 b: refs/heads/master c: 24b4922 h: refs/heads/master i: 167721: 0076607 167719: 01a4003 v: v3
1 parent 2ece567 commit fd9f0d8

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5de9f47e49200f1e9e367144d184446ddde9105b
2+
refs/heads/master: 24b49228f0dbd5a4b59a5297532f4b9cb4dfdc6a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c89417130f042c58adc60012e7cddc4ef70b70b9
55
refs/heads/try: 5204084bd2e46af7cc6e0147430e44dd0d657bbb

trunk/src/librustc_trans/trans/expr.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,16 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
299299
// into a type to be destructed. If we want to end up with a Box pointer,
300300
// then mk_ty should make a Box pointer (T -> Box<T>), if we want a
301301
// 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+
308312
debug!("unsized_info(kind={}, id={}, unadjusted_ty={})",
309313
kind, id, unadjusted_ty.repr(bcx.tcx()));
310314
match kind {
@@ -314,7 +318,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
314318
let ty_substs = substs.types.get_slice(subst::TypeSpace);
315319
// The dtor for a field treats it like a value, so mk_ty
316320
// 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)
318322
}
319323
_ => bcx.sess().bug(format!("UnsizeStruct with bad sty: {}",
320324
bcx.ty_to_string(unadjusted_ty))[])

0 commit comments

Comments
 (0)