summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-15104.rs
blob: 47b207ea9cbf5e290738fc389d41572f3f08ad08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-pass

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

fn count_members(v: &[usize]) -> usize {
    match *v {
        []         => 0,
        [_]        => 1,
        [_, ref xs @ ..] => 1 + count_members(xs)
    }
}