Skip to content

ICE when using type parameters of an impl. #2445

Closed
@paulstansifer

Description

@paulstansifer

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  

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions