Skip to content

Commit d442713

Browse files
committed
---
yaml --- r: 63666 b: refs/heads/snap-stage3 c: 663f298 h: refs/heads/master v: v3
1 parent 338d6ef commit d442713

File tree

4 files changed

+18
-25
lines changed

4 files changed

+18
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 3c867114525068275bd403ba5b1918d507a38933
4+
refs/heads/snap-stage3: 663f29818310c7aad3b1501fe8eac6ca2379e037
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,21 +1683,20 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
16831683

16841684
match fcx.llself {
16851685
Some(slf) => {
1686-
// We really should do this regardless of whether self is owned, but
1687-
// it doesn't work right with default method impls yet. (FIXME: #2794)
1688-
if slf.is_owned {
1689-
let self_val = if datum::appropriate_mode(slf.t).is_by_value() {
1690-
let tmp = BitCast(bcx, slf.v, type_of(bcx.ccx(), slf.t));
1691-
let alloc = alloc_ty(bcx, slf.t);
1692-
Store(bcx, tmp, alloc);
1693-
alloc
1694-
} else {
1695-
PointerCast(bcx, slf.v, type_of(bcx.ccx(), slf.t).ptr_to())
1696-
};
1697-
1698-
fcx.llself = Some(ValSelfData {v: self_val, ..slf});
1699-
add_clean(bcx, self_val, slf.t);
1700-
}
1686+
let self_val = if slf.is_owned
1687+
&& datum::appropriate_mode(slf.t).is_by_value() {
1688+
let tmp = BitCast(bcx, slf.v, type_of(bcx.ccx(), slf.t));
1689+
let alloc = alloc_ty(bcx, slf.t);
1690+
Store(bcx, tmp, alloc);
1691+
alloc
1692+
} else {
1693+
PointerCast(bcx, slf.v, type_of(bcx.ccx(), slf.t).ptr_to())
1694+
};
1695+
1696+
fcx.llself = Some(ValSelfData {v: self_val, ..slf});
1697+
if slf.is_owned {
1698+
add_clean(bcx, self_val, slf.t);
1699+
}
17011700
}
17021701
_ => {}
17031702
}

branches/snap-stage3/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,14 +1051,8 @@ pub fn trans_local_var(bcx: block, def: ast::def) -> Datum {
10511051
debug!("def_self() reference, self_info.t=%s",
10521052
self_info.t.repr(bcx.tcx()));
10531053

1054-
// This cast should not be necessary. We should cast self *once*,
1055-
// but right now this conflicts with default methods.
1056-
let real_self_ty = monomorphize_type(bcx, self_info.t);
1057-
let llselfty = type_of::type_of(bcx.ccx(), real_self_ty).ptr_to();
1058-
1059-
let casted_val = PointerCast(bcx, self_info.v, llselfty);
10601054
Datum {
1061-
val: casted_val,
1055+
val: self_info.v,
10621056
ty: self_info.t,
10631057
mode: ByRef(ZeroMem)
10641058
}

branches/snap-stage3/src/librustc/middle/trans/meth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ pub fn trans_method(ccx: @mut CrateContext,
103103
let self_ty = ty::node_id_to_type(ccx.tcx, method.self_id);
104104
let self_ty = match param_substs {
105105
None => self_ty,
106-
Some(@param_substs {tys: ref tys, _}) => {
107-
ty::subst_tps(ccx.tcx, *tys, None, self_ty)
106+
Some(@param_substs {tys: ref tys, self_ty: ref self_sub, _}) => {
107+
ty::subst_tps(ccx.tcx, *tys, *self_sub, self_ty)
108108
}
109109
};
110110
debug!("calling trans_fn with self_ty %s",

0 commit comments

Comments
 (0)