Skip to content

Commit 6e347b8

Browse files
committed
---
yaml --- r: 82117 b: refs/heads/master c: e08391c h: refs/heads/master i: 82115: 515d700 v: v3
1 parent 4aed7b2 commit 6e347b8

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6d598989f62c15b6093cdaf116f2f6318ed1b95c
2+
refs/heads/master: e08391c3f1933a290ec38c6d6f6d21befba3f756
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729

trunk/src/librustc/middle/trans/common.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ pub fn type_is_immediate(ccx: &mut CrateContext, ty: ty::t) -> bool {
6969
if simple {
7070
return true;
7171
}
72-
// FIXME: #9651: C-like enums should also be immediate
73-
if ty::type_is_c_like_enum(ccx.tcx, ty) {
74-
return false;
75-
}
7672
match ty::get(ty).sty {
7773
// FIXME: #9651: small `ty_struct` should also be immediate
74+
ty::ty_struct(def_id, ref substs) => {
75+
ty::struct_fields(tcx, def_id, substs).is_empty()
76+
}
7877
ty::ty_enum(*) | ty::ty_tup(*) => {
7978
let llty = sizing_type_of(ccx, ty);
8079
llsize_of_alloc(ccx, llty) <= llsize_of_alloc(ccx, ccx.int_type)

trunk/src/librustc/middle/trans/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,9 @@ fn trans_imm_cast(bcx: @mut Block, expr: &ast::Expr,
17271727
(cast_enum, cast_float) => {
17281728
let bcx = bcx;
17291729
let repr = adt::represent_type(ccx, t_in);
1730-
let lldiscrim_a = adt::trans_get_discr(bcx, repr, llexpr);
1730+
let slot = Alloca(bcx, ll_t_in, "");
1731+
Store(bcx, llexpr, slot);
1732+
let lldiscrim_a = adt::trans_get_discr(bcx, repr, slot);
17311733
match k_out {
17321734
cast_integral => int_cast(bcx, ll_t_out,
17331735
val_ty(lldiscrim_a),

trunk/src/librustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ pub fn trans_native_call(bcx: @mut Block,
222222
// Ensure that we always have the Rust value indirectly,
223223
// because it makes bitcasting easier.
224224
if !rust_indirect {
225-
let scratch = base::alloca(bcx, arg_tys[i].ty, "__arg");
225+
let scratch = base::alloca(bcx, type_of::type_of(ccx, fn_sig.inputs[i]), "__arg");
226226
Store(bcx, llarg_rust, scratch);
227227
llarg_rust = scratch;
228228
}

trunk/src/librustc/middle/trans/intrinsic.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
use back::{abi};
1414
use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg};
15-
use lib::llvm::{ValueRef, Pointer};
15+
use lib::llvm::{ValueRef, Pointer, Array, Struct};
1616
use lib;
1717
use middle::trans::base::*;
1818
use middle::trans::build::*;
@@ -333,8 +333,12 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
333333
(Pointer, other) | (other, Pointer) if other != Pointer => {
334334
let tmp = Alloca(bcx, llouttype, "");
335335
Store(bcx, llsrcval, PointerCast(bcx, tmp, llintype.ptr_to()));
336-
let ll_load = Load(bcx, tmp);
337-
Ret(bcx, ll_load);
336+
Ret(bcx, Load(bcx, tmp));
337+
}
338+
(Array, _) | (_, Array) | (Struct, _) | (_, Struct) => {
339+
let tmp = Alloca(bcx, llouttype, "");
340+
Store(bcx, llsrcval, PointerCast(bcx, tmp, llintype.ptr_to()));
341+
Ret(bcx, Load(bcx, tmp));
338342
}
339343
_ => {
340344
let llbitcast = BitCast(bcx, llsrcval, llouttype);

0 commit comments

Comments
 (0)