Skip to content

Commit 2a56612

Browse files
committed
---
yaml --- r: 31684 b: refs/heads/dist-snap c: f3b2296 h: refs/heads/master v: v3
1 parent 2266d03 commit 2a56612

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
@@ -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: aacd18f4ed860420cb89cd103a9832ef47e838f3
10+
refs/heads/dist-snap: f3b2296ee4d2cdd902207cdc52b35dbe4e50427c
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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