about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-11-03 15:50:04 -0500
committerNiko Matsakis <niko@alum.mit.edu>2015-11-03 18:00:35 -0500
commitb46c0fc49749affc0fc953e8cdc136f5aff5c1b3 (patch)
tree6b39a3206d8393f48327dc9474189854c588a748 /src
parent9c9f4be9df863e529b09f195f013710e676fb5c1 (diff)
downloadrust-b46c0fc49749affc0fc953e8cdc136f5aff5c1b3.tar.gz
rust-b46c0fc49749affc0fc953e8cdc136f5aff5c1b3.zip
address nits from dotdash
Diffstat (limited to 'src')
-rw-r--r--src/librustc_trans/trans/mir/analyze.rs4
-rw-r--r--src/librustc_trans/trans/mir/mod.rs3
-rw-r--r--src/librustc_trans/trans/mir/rvalue.rs10
3 files changed, 13 insertions, 4 deletions
diff --git a/src/librustc_trans/trans/mir/analyze.rs b/src/librustc_trans/trans/mir/analyze.rs
index acf6e53468e..f5fa897bca6 100644
--- a/src/librustc_trans/trans/mir/analyze.rs
+++ b/src/librustc_trans/trans/mir/analyze.rs
@@ -30,7 +30,7 @@ pub fn lvalue_temps<'bcx,'tcx>(bcx: Block<'bcx,'tcx>,
         if
             ty.is_scalar() ||
             ty.is_unique() ||
-            ty.is_region_ptr() ||
+            (ty.is_region_ptr() && !common::type_is_fat_ptr(bcx.tcx(), ty)) ||
             ty.is_simd()
         {
             // These sorts of types are immediates that we can store
@@ -42,7 +42,7 @@ pub fn lvalue_temps<'bcx,'tcx>(bcx: Block<'bcx,'tcx>,
             // for newtypes, but we currently force some types
             // (e.g. structs) into an alloca unconditionally, just so
             // that we don't have to deal with having two pathways
-            // (gep vs getvalue etc).
+            // (gep vs extractvalue etc).
             analyzer.mark_as_lvalue(index);
         }
     }
diff --git a/src/librustc_trans/trans/mir/mod.rs b/src/librustc_trans/trans/mir/mod.rs
index fb652c6dc7e..3b018cc1321 100644
--- a/src/librustc_trans/trans/mir/mod.rs
+++ b/src/librustc_trans/trans/mir/mod.rs
@@ -55,6 +55,9 @@ pub struct MirContext<'bcx, 'tcx:'bcx> {
     ///     - nor should it appear in an lvalue path like `tmp.a`
     /// - the operand must be defined by an rvalue that can generate immediate
     ///   values
+    ///
+    /// Avoiding allocs can also be important for certain intrinsics,
+    /// notably `expect`.
     temps: Vec<TempRef<'tcx>>,
 
     /// The arguments to the function; as args are lvalues, these are
diff --git a/src/librustc_trans/trans/mir/rvalue.rs b/src/librustc_trans/trans/mir/rvalue.rs
index dc73c60c9a0..94cc7857a14 100644
--- a/src/librustc_trans/trans/mir/rvalue.rs
+++ b/src/librustc_trans/trans/mir/rvalue.rs
@@ -20,6 +20,7 @@ use trans::build;
 use trans::common::{self, Block, Result};
 use trans::debuginfo::DebugLoc;
 use trans::declare;
+use trans::expr;
 use trans::machine;
 use trans::type_::Type;
 use trans::type_of;
@@ -55,6 +56,9 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
 
             mir::Rvalue::Aggregate(_, ref operands) => {
                 for (i, operand) in operands.iter().enumerate() {
+                    // Note: perhaps this should be StructGep, but
+                    // note that in some cases the values here will
+                    // not be structs but arrays.
                     let lldest_i = build::GEPi(bcx, lldest, &[0, i]);
                     self.trans_operand_into(bcx, lldest_i, operand);
                 }
@@ -70,8 +74,10 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
                 let llbase1 = build::GEPi(bcx, llbase, &[from_start]);
                 let adj = common::C_uint(ccx, from_start + from_end);
                 let lllen1 = build::Sub(bcx, lllen, adj, DebugLoc::None);
-                build::Store(bcx, llbase1, build::GEPi(bcx, lldest, &[0, abi::FAT_PTR_ADDR]));
-                build::Store(bcx, lllen1, build::GEPi(bcx, lldest, &[0, abi::FAT_PTR_EXTRA]));
+                let lladdrdest = expr::get_dataptr(bcx, lldest);
+                build::Store(bcx, llbase1, lladdrdest);
+                let llmetadest = expr::get_meta(bcx, lldest);
+                build::Store(bcx, lllen1, llmetadest);
                 bcx
             }