Skip to content

Commit 0403119

Browse files
committed
---
yaml --- r: 47514 b: refs/heads/try c: 8a17066 h: refs/heads/master v: v3
1 parent 7a90c78 commit 0403119

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 5e2302a56f7615b73e42daaa242da4bd64b25d93
5+
refs/heads/try: 8a1706610b2cf458fe6e5ed12e227e3ca9dcaa6d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/trans/adt.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,24 +205,28 @@ pub fn trans_GEP(bcx: block, r: &Repr, val: ValueRef, discr: int, ix: uint)
205205
NoDtor => val,
206206
DtorPresent | DtorAbsent => GEPi(bcx, val, [0, 0])
207207
};
208-
struct_GEP(bcx, st, val, ix)
208+
struct_GEP(bcx, st, val, ix, false)
209209
}
210210
General(ref cases) => {
211211
struct_GEP(bcx, &cases[discr as uint],
212-
GEPi(bcx, val, [0, 1]), ix)
212+
GEPi(bcx, val, [0, 1]), ix, true)
213213
}
214214
}
215215
}
216216

217-
fn struct_GEP(bcx: block, st: &Struct, val: ValueRef, ix: uint)
218-
-> ValueRef {
217+
fn struct_GEP(bcx: block, st: &Struct, val: ValueRef, ix: uint,
218+
needs_cast: bool) -> ValueRef {
219219
let ccx = bcx.ccx();
220220

221-
let real_llty = T_struct(st.fields.map(
222-
|&ty| type_of::type_of(ccx, ty)));
223-
let cast_val = PointerCast(bcx, val, T_ptr(real_llty));
221+
let val = if needs_cast {
222+
let real_llty = T_struct(st.fields.map(
223+
|&ty| type_of::type_of(ccx, ty)));
224+
PointerCast(bcx, val, T_ptr(real_llty))
225+
} else {
226+
val
227+
};
224228

225-
GEPi(bcx, cast_val, [0, ix])
229+
GEPi(bcx, val, [0, ix])
226230
}
227231

228232
pub fn trans_const(ccx: @CrateContext, r: &Repr, discr: int,

0 commit comments

Comments
 (0)