]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-slice-pattern-element-loan-rpass.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-slice-pattern-element-loan-rpass.rs
1 // run-pass
2
3 fn mut_head_tail<'a, A>(v: &'a mut [A]) -> Option<(&'a mut A, &'a mut [A])> {
4     match *v {
5         [ref mut head, ref mut tail @ ..] => {
6             Some((head, tail))
7         }
8         [] => None
9     }
10 }
11
12 fn main() {
13     let mut v = [1,2,3,4];
14     match mut_head_tail(&mut v) {
15         None => {},
16         Some((h,t)) => {
17             *h = 1000;
18             t.reverse();
19         }
20     }
21 }