Skip to content

ICE with struct-like enum variants #4229

Closed
@catamorphism

Description

@catamorphism

I'm not even sure if this should work, but it does pass typechecking.

enum Animal {
    Dog (~str, float),
    Cat { name: ~str, weight: float }
}

fn main() {
    let mut a: Animal = Dog(~"Cocoa", 37.2);
    a = Cat{ name: ~"Spotty", weight: 2.7 };
}

This yields an ICE in trans:

error: internal compiler error: iter_variant: not a function type

The message is from trans::base::iter_structural_ty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions