]> git.lizzy.rs Git - rust.git/commitdiff
Make AdjustEmptyToAny actually perform the adjustment
authorAndrew Cann <shum@canndrew.org>
Mon, 1 Aug 2016 06:44:29 +0000 (14:44 +0800)
committerAndrew Cann <shum@canndrew.org>
Sat, 13 Aug 2016 13:37:09 +0000 (21:37 +0800)
src/librustc_trans/expr.rs

index 059532957b80551b10b485ffbb2832b7079c571b..fa2521205a8e18bf68e58430550a8987772b446a 100644 (file)
@@ -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 {