diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2017-04-11 14:31:20 +0300 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2017-04-11 15:21:07 +0300 |
| commit | a384f131cbb3e79154cc99ef0d025fc9ed6d9674 (patch) | |
| tree | faa775ce62bd3053cb8fc472d84b3c07b0777749 /src | |
| parent | d821e98fd73ee16c2f2733570220b2b64d367d45 (diff) | |
| download | rust-a384f131cbb3e79154cc99ef0d025fc9ed6d9674.tar.gz rust-a384f131cbb3e79154cc99ef0d025fc9ed6d9674.zip | |
Fix handling of closure arguments
Those did not take tuple reordering into account, causing majority of the compiler test suite to fail.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/ty/layout.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/mod.rs | 3 | ||||
| -rw-r--r-- | src/librustc_trans/intrinsic.rs | 9 | ||||
| -rw-r--r-- | src/librustc_trans/mir/mod.rs | 2 |
4 files changed, 9 insertions, 7 deletions
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index a344f89a668..d7a4b3fda63 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -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), diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index ba9c177f904..a2c356c20db 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1419,7 +1419,8 @@ impl_stable_hash_for!(struct ReprOptions { c, packed, simd, - int + int, + linear }); impl ReprOptions { diff --git a/src/librustc_trans/intrinsic.rs b/src/librustc_trans/intrinsic.rs index 5e7d612d17f..b6fbc2f5ad5 100644 --- a/src/librustc_trans/intrinsic.rs +++ b/src/librustc_trans/intrinsic.rs @@ -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) } diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_trans/mir/mod.rs index c8d15d28708..f4c9a136ace 100644 --- a/src/librustc_trans/mir/mod.rs +++ b/src/librustc_trans/mir/mod.rs @@ -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) { |
