Fix handling of closure arguments
Those did not take tuple reordering into account, causing majority of the compiler test suite to fail.
This commit is contained in:
parent
d821e98fd7
commit
a384f131cb
@ -598,7 +598,7 @@ impl<'a, 'gcx, 'tcx> Struct {
|
||||
// In addition, code in trans assume that 2-element structs can become pairs.
|
||||
// It's easier to just short-circuit here.
|
||||
let can_optimize = (fields.len() > 2 || StructKind::EnumVariant == kind)
|
||||
&& ! (repr.c || repr.packed || repr.linear || repr.simd);
|
||||
&& !(repr.c || repr.packed || repr.linear || repr.simd);
|
||||
|
||||
let (optimize, sort_ascending) = match kind {
|
||||
StructKind::AlwaysSizedUnivariant => (can_optimize, false),
|
||||
|
@ -1419,7 +1419,8 @@ impl_stable_hash_for!(struct ReprOptions {
|
||||
c,
|
||||
packed,
|
||||
simd,
|
||||
int
|
||||
int,
|
||||
linear
|
||||
});
|
||||
|
||||
impl ReprOptions {
|
||||
|
@ -16,7 +16,7 @@ use llvm;
|
||||
use llvm::{ValueRef};
|
||||
use abi::{Abi, FnType};
|
||||
use adt;
|
||||
use mir::lvalue::LvalueRef;
|
||||
use mir::lvalue::{LvalueRef, Alignment};
|
||||
use base::*;
|
||||
use common::*;
|
||||
use declare;
|
||||
@ -36,8 +36,6 @@ use syntax_pos::Span;
|
||||
use std::cmp::Ordering;
|
||||
use std::iter;
|
||||
|
||||
use mir::lvalue::Alignment;
|
||||
|
||||
fn get_simple_intrinsic(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
|
||||
let llvm_name = match name {
|
||||
"sqrtf32" => "llvm.sqrt.f32",
|
||||
@ -622,7 +620,10 @@ pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
|
||||
|
||||
for i in 0..elems.len() {
|
||||
let val = bcx.extract_value(val, i);
|
||||
bcx.store(val, bcx.struct_gep(llresult, i), None);
|
||||
let lval = LvalueRef::new_sized_ty(llresult, ret_ty,
|
||||
Alignment::AbiAligned);
|
||||
let (dest, _) = lval.trans_field_ptr(bcx, i);
|
||||
bcx.store(val, dest, None);
|
||||
}
|
||||
C_nil(ccx)
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ fn arg_local_refs<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
|
||||
|
||||
let lvalue = LvalueRef::alloca(bcx, arg_ty, &format!("arg{}", arg_index));
|
||||
for (i, &tupled_arg_ty) in tupled_arg_tys.iter().enumerate() {
|
||||
let dst = bcx.struct_gep(lvalue.llval, i);
|
||||
let (dst, _) = lvalue.trans_field_ptr(bcx, i);
|
||||
let arg = &mircx.fn_ty.args[idx];
|
||||
idx += 1;
|
||||
if common::type_is_fat_ptr(bcx.ccx, tupled_arg_ty) {
|
||||
|
Loading…
Reference in New Issue
Block a user