Skip to content

Self-referential templated trait overflows the stack #15477

Closed
@lee-b

Description

@lee-b

Compiling the following:

trait Chromosome<C: Chromosome> {
    fn random() -> C;
}

Causes the following output:

task 'rustc' has overflowed its stack
Illegal instruction

The code was an unintentional typo, and probably isn't valid, but I think the compiler should handle this a lot better, as there's no indication of what the problem is, or where it lies. In large compilation units with complex templating etc., that could be a big roadblock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type 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