Skip to content

ICE when calling method on trait object with incorrect self type #5153

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

Closed
jdm opened this issue Feb 27, 2013 · 6 comments
Closed

ICE when calling method on trait object with incorrect self type #5153

jdm opened this issue Feb 27, 2013 · 6 comments
Labels
A-trait-system Area: Trait system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jdm
Copy link
Contributor

jdm commented Feb 27, 2013

trait Foo {
    fn foo(~self);
}

impl Foo for int {
    fn foo(~self) {
    }
}

fn main() {
    (@5 as @Foo).foo();
}

error: internal compiler error: ~self receiver with non-~Trait

@ghost ghost assigned catamorphism Feb 28, 2013
@catamorphism
Copy link
Contributor

I thought maybe I could fix this quickly, but the interaction in typeck::check::method between auto-derefing and (the currently nonexistent checking of) non-@ traits is making my brain hurt. So, de-milestoning.

@catamorphism
Copy link
Contributor

Reproduced in 0252c30 -- nominating for milestone 5, production-ready.

@graydon
Copy link
Contributor

graydon commented May 23, 2013

accepted for production-ready milestone

@nikomatsakis
Copy link
Contributor

Almost certainly would be fixed by #5762

@graydon
Copy link
Contributor

graydon commented Jul 18, 2013

updated code example, still ICEs.

@jdm
Copy link
Contributor Author

jdm commented Sep 22, 2013

No more ICE:

/tmp/d.rs:11:4: 11:23 error: type `@Foo:'static` does not implement any method in scope named `foo`
/tmp/d.rs:11     (@5 as @Foo).foo();
                 ^~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

Flagging as needstest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants