Skip to content

Commit 345de85

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 170465 b: refs/heads/try c: 24b4922 h: refs/heads/master i: 170463: 9ffd1dc v: v3
1 parent a8166d0 commit 345de85

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 73a25f55ad748b4d3516417c711b99ce446591af
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: 5de9f47e49200f1e9e367144d184446ddde9105b
5+
refs/heads/try: 24b49228f0dbd5a4b59a5297532f4b9cb4dfdc6a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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)