Skip to content
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

ICE when default method relies on where clauses that object type does not satisfy #23435

Closed
nikomatsakis opened this issue Mar 17, 2015 · 2 comments · Fixed by #23438
Closed
Assignees

Comments

@nikomatsakis
Copy link
Contributor

This is problem blocking #23300:

struct Foo {
    x: i32
}

trait Bar {
    fn bar(&self) where Self : Baz { self.baz(); }
}

trait Baz {
    fn baz(&self);
}

impl Bar for Foo {
}

fn main() {
    let x: &Bar = &Foo { x: 22 };
}

That example encounters an ICE when building the vtable of Bar for Foo. The problem is that the default method bar requires that Self:Baz, which is not true for Foo. This is ok, since it could never be called, but the trans code doesn't know that (yet!).

@nikomatsakis
Copy link
Contributor Author

Got a fix that seems to be working. Running make check now.

@nikomatsakis
Copy link
Contributor Author

(Branch is issue-23435-default-methods-with-where-clauses on my repo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant