Skip to content

Commit a4254b4

Browse files
committed
---
yaml --- r: 32339 b: refs/heads/dist-snap c: b808cfb h: refs/heads/master i: 32337: d3b2cbd 32335: 6877eb3 v: v3
1 parent b02ed90 commit a4254b4

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 49c9ac175f07505f2113feaca3546d4b8b44dfa8
10+
refs/heads/dist-snap: b808cfbb74a6d9ee01d22a1754f8ddfe3022b1e5
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/rustc/middle/trans/base.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3151,6 +3151,9 @@ fn trans_arg_expr(cx: block, arg: ty::arg, lldestty: TypeRef, e: @ast::expr,
31513151
// routine consults this table and performs these adaptations. It returns a
31523152
// new location for the borrowed result as well as a new type for the argument
31533153
// that reflects the borrowed value and not the original.
3154+
//
3155+
// NB: "e" has already been translated; do not translate it again. If you do,
3156+
// this will cause problems with autoderef and method receivers (bug #3357).
31543157
fn adapt_borrowed_value(lv: lval_result,
31553158
e: @ast::expr,
31563159
e_ty: ty::t) -> {lv: lval_result,
@@ -3200,7 +3203,7 @@ fn adapt_borrowed_value(lv: lval_result,
32003203

32013204
_ => {
32023205
// Just take a reference. This is basically like trans_addr_of.
3203-
let mut {bcx, val, kind} = trans_temp_lval(bcx, e);
3206+
let mut {bcx, val, kind} = lv;
32043207
let is_immediate = ty::type_is_immediate(e_ty);
32053208
if (kind == lv_temporary && is_immediate) || kind == lv_owned_imm {
32063209
val = do_spill(bcx, val, e_ty);

branches/dist-snap/src/rustc/middle/typeck/check/method.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ struct lookup {
183183
match ty::deref(self.tcx(), self.self_ty, false) {
184184
None => break,
185185
Some(mt) => {
186+
debug!("(checking method) ... autodereffing");
186187
self.self_ty = mt.ty;
187188
self.derefs += 1u;
188189
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
struct Foo {
2+
x: int;
3+
}
4+
5+
impl Foo {
6+
fn f(&self) {}
7+
}
8+
9+
fn g(x: &mut Foo) {
10+
x.f();
11+
}
12+
13+
fn main() {
14+
}
15+

0 commit comments

Comments
 (0)