Skip to content

Commit 10d3351

Browse files
committed
---
yaml --- r: 20914 b: refs/heads/snap-stage3 c: f3b2296 h: refs/heads/master v: v3
1 parent d89dd08 commit 10d3351

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,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: aacd18f4ed860420cb89cd103a9832ef47e838f3
4+
refs/heads/snap-stage3: f3b2296ee4d2cdd902207cdc52b35dbe4e50427c
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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
}
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)