Skip to content

Regression on array pattern-matching #15104

Closed
@renato-zannon

Description

@renato-zannon

Until friday (commit 3047614) the following (very contrived) code compiled:

fn main() {
    println!("{}", count_members(&[1, 2, 3, 4]));
}

fn count_members(v: &[uint]) -> uint {
    match v {
        []         => 0,
        [_]        => 1,
        [_x, ..xs] => 1 + count_members(xs)
    }
}

With ca3e557, it fails with:

array_match.rs:9:5: 9:15 error: unreachable pattern
array_match.rs:9     [_x, ..xs] => 1 + count_members(xs)
                     ^~~~~~~~~~
error: aborting due to previous error

I'll try to bisect and get to a single commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions