Skip to content

Commit cf82bca

Browse files
committed
---
yaml --- r: 23022 b: refs/heads/master c: f3b2296 h: refs/heads/master v: v3
1 parent 94e148d commit cf82bca

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
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: aacd18f4ed860420cb89cd103a9832ef47e838f3
2+
refs/heads/master: f3b2296ee4d2cdd902207cdc52b35dbe4e50427c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/rustc/middle/trans/impl.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import lib::llvm::llvm;
1414
import lib::llvm::{ValueRef, TypeRef};
1515
import lib::llvm::llvm::LLVMGetParam;
1616
import std::map::hashmap;
17+
import util::ppaux::{ty_to_str, tys_to_str};
18+
19+
import syntax::print::pprust::expr_to_str;
1720

1821
fn trans_impl(ccx: @crate_ctxt, path: path, name: ast::ident,
1922
methods: ~[@ast::method], tps: ~[ast::ty_param]) {
@@ -70,6 +73,9 @@ fn trans_method_callee(bcx: block, callee_id: ast::node_id,
7073
typeck::method_trait(_, off) => {
7174
let {bcx, val} = trans_temp_expr(bcx, self);
7275
let fty = node_id_type(bcx, callee_id);
76+
let self_ty = node_id_type(bcx, self.id);
77+
let {bcx, val, _} = autoderef(bcx, self.id, val, self_ty,
78+
uint::max_value);
7379
trans_trait_callee(bcx, val, fty, off)
7480
}
7581
}

trunk/src/test/run-pass/issue-2935.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//type t = { a: int };
2+
// type t = { a: bool };
3+
type t = bool;
4+
5+
trait it {
6+
fn f();
7+
}
8+
9+
impl of it for t {
10+
fn f() { }
11+
}
12+
13+
fn main() {
14+
// let x = ({a: 4i} as it);
15+
// let y = @({a: 4i});
16+
// let z = @({a: 4i} as it);
17+
// let z = @({a: true} as it);
18+
let z = @(true as it);
19+
// x.f();
20+
// y.f();
21+
// (*z).f();
22+
#error["ok so far..."];
23+
z.f(); //segfault
24+
}

0 commit comments

Comments
 (0)