]> git.lizzy.rs Git - rust.git/commitdiff
rollup merge of #22437: dotdash/fix_array_type
authorAlex Crichton <alex@alexcrichton.com>
Wed, 18 Feb 2015 22:31:59 +0000 (14:31 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 18 Feb 2015 22:31:59 +0000 (14:31 -0800)
In trans_slice_vec we currently use arrayalloca, which gives us a
pointer to the element type with enough memory allocated for the
requested number of elements.  This works, but everywhere else we use
the [n x T] type for fixed size arrays and so we have to bitcast the
pointer here. Let's directly use the proper type for the allocation and
remove some code duplication along the way.

1  2 
src/librustc_trans/trans/base.rs

index 62d4dbeb0ad0c94c659206b6b05f48657667724e,971d73aa899b61cbd2e72eee6412542d07d4cbca..b299f6f897176cb66d0b8b0bd59f5d66a7f786d1
@@@ -1219,19 -1219,6 +1219,6 @@@ pub fn alloca_zeroed<'blk, 'tcx>(cx: Bl
      p
  }
  
- pub fn arrayalloca(cx: Block, ty: Type, v: ValueRef) -> ValueRef {
-     let _icx = push_ctxt("arrayalloca");
-     if cx.unreachable.get() {
-         unsafe {
-             return llvm::LLVMGetUndef(ty.to_ref());
-         }
-     }
-     debuginfo::clear_source_location(cx.fcx);
-     let p = ArrayAlloca(cx, ty, v);
-     call_lifetime_start(cx, p);
-     p
- }
  // Creates the alloca slot which holds the pointer to the slot for the final return value
  pub fn make_return_slot_pointer<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>,
                                            output_type: Ty<'tcx>) -> ValueRef {
@@@ -3211,7 -3198,7 +3198,7 @@@ pub fn trans_crate<'tcx>(analysis: ty::
      reachable.push("rust_eh_personality_catch".to_string());
  
      if codegen_units > 1 {
 -        internalize_symbols(&shared_ccx, &reachable.iter().map(|x| x.clone()).collect());
 +        internalize_symbols(&shared_ccx, &reachable.iter().cloned().collect());
      }
  
      let metadata_module = ModuleTranslation {