os-rust/tests/ui/pattern/issue-15080.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
429 B
Rust
Raw Normal View History

//@ run-pass
fn main() {
2015-01-25 22:05:03 +01:00
let mut x: &[_] = &[1, 2, 3, 4];
let mut result = vec![];
loop {
x = match *x {
2019-07-08 01:47:46 +02:00
[1, n, 3, ref rest @ ..] => {
result.push(n);
rest
}
2019-07-08 01:47:46 +02:00
[n, ref rest @ ..] => {
result.push(n);
rest
}
[] =>
break
}
}
assert_eq!(result, [2, 4]);
}