Skip to content

ICE: Error compiling with generic default methods #7295

Closed
@Aatch

Description

@Aatch

This code:

pub trait Foo<T> {

    pub fn func1<U>(&self, t: U);

    pub fn func2<U>(&mut self, t: U) {
        self.func1(t); // Compiles if this is omitted
    }

}

Fails with the message: 'index out of bounds: the len is 1 but the index is 1', /home/james/projects/rust/compiler/src/librustc/middle/subst.rs:58

Seems to be getting mixed up with the trait parameters, if I add another type parameter to Foo, I get an index of 2, instead of 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions