Skip to content

Commit b1dd801

Browse files
committed
---
yaml --- r: 16268 b: refs/heads/try c: 8972588 h: refs/heads/master v: v3
1 parent 23b67f1 commit b1dd801

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 7daf986aeca81a72be5869a5a41d4fde753eca0f
5+
refs/heads/try: 8972588583398b207f0f7033b2af20bca509eba7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/trans/base.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,19 +2448,7 @@ fn trans_local_var(cx: block, def: ast::def) -> local_var_result {
24482448
}
24492449
ast::def_self(sid) {
24502450
let slf = alt copy cx.fcx.llself {
2451-
some(s) {
2452-
alt option::map(ty::ty_to_def_id(s.t)) {|did|
2453-
ty::ty_dtor(cx.tcx(), did)} {
2454-
some(some(_)) {
2455-
/* self is a class with a dtor, which means we
2456-
have to select out the object itself
2457-
(If any other code does the same thing, that's
2458-
a bug */
2459-
GEPi(cx, cast_self(cx, s), [0u, 1u])
2460-
}
2461-
_ { cast_self(cx, s) }
2462-
}
2463-
}
2451+
some(s) { cast_self(cx, s) }
24642452
none { cx.sess().bug("trans_local_var: reference to self \
24652453
out of context"); }
24662454
};
@@ -2535,17 +2523,29 @@ fn trans_rec_field(bcx: block, base: @ast::expr,
25352523

25362524
fn trans_rec_field_inner(bcx: block, val: ValueRef, ty: ty::t,
25372525
field: ast::ident, sp: span) -> lval_result {
2526+
let mut deref = false;
25382527
let fields = alt ty::get(ty).struct {
25392528
ty::ty_rec(fs) { fs }
25402529
ty::ty_class(did, substs) {
2530+
if option::is_some(ty::ty_dtor(bcx.tcx(), did)) {
2531+
deref = true;
2532+
}
25412533
ty::class_items_as_fields(bcx.tcx(), did, substs)
25422534
}
25432535
// Constraint?
25442536
_ { bcx.tcx().sess.span_bug(sp, "trans_rec_field:\
25452537
base expr has non-record type"); }
25462538
};
25472539
let ix = field_idx_strict(bcx.tcx(), sp, field, fields);
2548-
let val = GEPi(bcx, val, [0u, ix]);
2540+
2541+
/* self is a class with a dtor, which means we
2542+
have to select out the object itself
2543+
(If any other code does the same thing, that's
2544+
a bug */
2545+
let val = if deref {
2546+
GEPi(bcx, GEPi(bcx, val, [0u, 1u]), [0u, ix])
2547+
}
2548+
else { GEPi(bcx, val, [0u, ix]) };
25492549

25502550
ret {bcx: bcx, val: val, kind: owned};
25512551
}

0 commit comments

Comments
 (0)