Skip to content

"sequence_element_type called on non-sequence value" on pattern-matching vectors #10845

@agrif

Description

@agrif

Compiling this small snippet

enum Expression {
    Symbol(~str),
    Compound(~str, ~[Expression])
}

fn standard_form(expr: &Expression) -> ~str {
    match (*expr) {
        Compound(~"List", ref items) => ~"list",

        Compound(~"Blank", []) => ~"_",

        _ => ~"default"
    }
}

fn main() {
    let x = ~Symbol(~"x");
    println(standard_form(x));
}

yields the following error

error: internal compiler error: sequence_element_type called on non-sequence value
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
task 'rustc' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/libsyntax/diagnostic.rs:102
task '<main>' failed at 'explicit failure', /var/tmp/portage/dev-lang/rust-9999/work/rust-9999/src/librustc/lib.rs:394

Swapping the order of the List and Blank cases makes the error go away. This might be a duplicate of Issue #7990, but the code there that elicits this is so different I thought it'd be worthwhile to open a whole new issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-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