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 using type parameters of an impl. #2445

Closed
paulstansifer opened this issue May 25, 2012 · 4 comments
Closed

ICE when using type parameters of an impl. #2445

paulstansifer opened this issue May 25, 2012 · 4 comments
Labels
A-typesystem Area: The type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@paulstansifer
Copy link
Contributor

The error is in kind checking. It looks like the impl cannot use the type parameter T.

import dvec::dvec;

class c1<T: copy> {
    new() {}

    fn f1(x: T) {} // OK
}

impl i1<T: copy> for c1<T> {
    fn f2(x: T) {} // can't be used
}


fn main() {
    c1::<int>().f1(4);
    c1::<int>().f2(4); //comment out this line, and the ICE disappears
}

The error is

rust: upcall fail 'Internal error: in kind::check_expr, length mismatch between actual and declared bounds: actual 
= int (1 tys), declared = [@[bound_copy], @[bound_copy]] (2 tys)', /home/rustbuild/src/rustbot/workspace-snap-stage
3-x86_64-unknown-linux-gnu/src/src/rustc/middle/kind.rs:269  
@paulstansifer
Copy link
Contributor Author

It turns out that you can get the same issue, even if the type parameters aren't used:

class c1<T: copy> {
    new() {}

    fn f1(x: int) {
    }
}

impl i1<T: copy> for c1<T> {
    fn f2(x: int) {
    }
}


fn main() {
    c1::<int>().f1(4);
    c1::<int>().f2(4); //comment out to prevent ICE
}

@ghost ghost assigned catamorphism May 30, 2012
@catamorphism
Copy link
Contributor

I'll take this.

@catamorphism
Copy link
Contributor

I looked at it... I'm going to say that #2364 blocks this. It looks like another bug resulting from concatenating the iface ty params with method ty params in one place but not the other.

@catamorphism
Copy link
Contributor

Happily, this seems to have been accidentally fixed at some point. I added the test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants