Skip to content

Fix ICE caused by my previous patch, #9527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/middle/typeck/check/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ impl<'self> LookupContext<'self> {

Candidate {
rcvr_match_condition: RcvrMatchesIfObject(did),
rcvr_substs: trait_ref.substs.clone(),
rcvr_substs: new_trait_ref.substs.clone(),
method_ty: m,
origin: method_object(method_object {
trait_id: trait_ref.def_id,
trait_id: new_trait_ref.def_id,
object_trait_id: did,
method_num: method_num,
real_index: vtable_index
Expand Down
9 changes: 9 additions & 0 deletions src/test/run-pass/issue-9394-inherited-trait-calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

trait Base: Base2 + Base3{
fn foo(&self) -> ~str;
fn foo1(&self) -> ~str;
fn foo2(&self) -> ~str{
~"base foo2"
}
}

trait Base2: Base3{
Expand All @@ -30,6 +34,9 @@ impl Base for X {
fn foo(&self) -> ~str{
~"base foo"
}
fn foo1(&self) -> ~str{
~"base foo1"
}

}

Expand All @@ -56,6 +63,8 @@ pub fn main() {
let s = &n as &Super;
assert_eq!(s.bar(),~"super bar");
assert_eq!(s.foo(),~"base foo");
assert_eq!(s.foo1(),~"base foo1");
assert_eq!(s.foo2(),~"base foo2");
assert_eq!(s.baz(),~"base2 baz");
assert_eq!(s.root(),~"base3 root");
}