From: Andrew Cann Date: Mon, 1 Aug 2016 06:44:29 +0000 (+0800) Subject: Make AdjustEmptyToAny actually perform the adjustment X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=0e1c2aa52e7ec3f162ab4436c2ed0746d1992109;p=rust.git Make AdjustEmptyToAny actually perform the adjustment --- diff --git a/src/librustc_trans/expr.rs b/src/librustc_trans/expr.rs index 059532957b8..fa2521205a8 100644 --- a/src/librustc_trans/expr.rs +++ b/src/librustc_trans/expr.rs @@ -381,11 +381,11 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, debug!("unadjusted datum for expr {:?}: {:?} adjustment={:?}", expr, datum, adjustment); match adjustment { - AdjustEmptyToAny(..) => { - let const_ty = expr_ty(bcx, expr); - let llty = type_of::type_of(bcx.ccx(), const_ty); + AdjustEmptyToAny(ref target) => { + let mono_target = bcx.monomorphize(target); + let llty = type_of::type_of(bcx.ccx(), mono_target); let dummy = C_undef(llty.ptr_to()); - datum = Datum::new(dummy, const_ty, Rvalue::new(ByRef)).to_expr_datum(); + datum = Datum::new(dummy, mono_target, Rvalue::new(ByRef)).to_expr_datum(); } AdjustReifyFnPointer => { match datum.ty.sty {